MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaS_newudata

Function luaS_newudata

third-party/lua-5.1.5/src/lstring.c:96–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94
95
96Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
97 Udata *u;
98 if (s > MAX_SIZET - sizeof(Udata))
99 luaM_toobig(L);
100 u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
101 u->uv.marked = luaC_white(G(L)); /* is not finalized */
102 u->uv.tt = LUA_TUSERDATA;
103 u->uv.len = s;
104 u->uv.metatable = NULL;
105 u->uv.env = e;
106 /* chain it on udata list (after main thread) */
107 u->uv.next = G(L)->mainthread->next;
108 G(L)->mainthread->next = obj2gco(u);
109 return u;
110}
111

Callers 1

lua_newuserdataFunction · 0.70

Calls 1

luaM_toobigFunction · 0.70

Tested by

no test coverage detected