MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaS_newudata

Function luaS_newudata

3rd/lua-5.4.3/src/lstring.c:258–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256
257
258Udata *luaS_newudata (lua_State *L, size_t s, int nuvalue) {
259 Udata *u;
260 int i;
261 GCObject *o;
262 if (l_unlikely(s > MAX_SIZE - udatamemoffset(nuvalue)))
263 luaM_toobig(L);
264 o = luaC_newobj(L, LUA_VUSERDATA, sizeudata(nuvalue, s));
265 u = gco2u(o);
266 u->len = s;
267 u->nuvalue = nuvalue;
268 u->metatable = NULL;
269 for (i = 0; i < nuvalue; i++)
270 setnilvalue(&u->uv[i].uv);
271 return u;
272}
273

Callers 1

lua_newuserdatauvFunction · 0.85

Calls 2

luaM_toobigFunction · 0.85
luaC_newobjFunction · 0.85

Tested by

no test coverage detected