MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaS_newudata

Function luaS_newudata

other_src/lua/src/lstring.cpp:124–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

122
123
124Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
125 Udata *u;
126 if (s > MAX_SIZET - sizeof(Udata))
127 luaM_toobig(L);
128 u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
129 u->uv.marked = luaC_white(G(L)); /* is not finalized */
130 u->uv.tt = LUA_TUSERDATA;
131 u->uv.len = s;
132 u->uv.metatable = NULL;
133 u->uv.env = e;
134 u->uv.extra = NULL;
135 /* chain it on udata list (after main thread) */
136 u->uv.next = G(L)->mainthread->next;
137 G(L)->mainthread->next = obj2gco(u);
138 return u;
139}
140

Callers 1

lua_newuserdataFunction · 0.70

Calls 1

luaM_toobigFunction · 0.70

Tested by

no test coverage detected