MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / luaS_newudata

Function luaS_newudata

Source/Misc/lua/src/lua.c:9225–9239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9223
9224
9225Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
9226Udata *u;
9227if (s > MAX_SIZET - sizeof(Udata))
9228luaM_toobig(L);
9229u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
9230u->uv.marked = luaC_white(G(L)); /* is not finalized */
9231u->uv.tt = LUA_TUSERDATA;
9232u->uv.len = s;
9233u->uv.metatable = NULL;
9234u->uv.env = e;
9235/* chain it on udata list (after main thread) */
9236u->uv.next = G(L)->mainthread->next;
9237G(L)->mainthread->next = obj2gco(u);
9238return u;
9239}
9240
9241/*
9242** $Id: ltable.c,v 2.32.1.2 2007/12/28 15:32:23 roberto Exp $

Callers 1

lua_newuserdataFunction · 0.85

Calls 1

luaM_toobigFunction · 0.85

Tested by

no test coverage detected