MCPcopy Create free account
hub / github.com/DFHack/dfhack / newbox

Function newbox

depends/lua/src/lauxlib.c:482–492  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480
481
482static void *newbox (lua_State *L, size_t newsize) {
483 UBox *box = (UBox *)lua_newuserdata(L, sizeof(UBox));
484 box->box = NULL;
485 box->bsize = 0;
486 if (luaL_newmetatable(L, "LUABOX")) { /* creating metatable? */
487 lua_pushcfunction(L, boxgc);
488 lua_setfield(L, -2, "__gc"); /* metatable.__gc = boxgc */
489 }
490 lua_setmetatable(L, -2);
491 return resizebox(L, -1, newsize);
492}
493
494
495/*

Callers 1

luaL_prepbuffsizeFunction · 0.85

Calls 5

lua_newuserdataFunction · 0.85
luaL_newmetatableFunction · 0.85
lua_setfieldFunction · 0.85
lua_setmetatableFunction · 0.85
resizeboxFunction · 0.85

Tested by

no test coverage detected