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