| 298 | |
| 299 | |
| 300 | static void close_state (lua_State *L) { |
| 301 | global_State *g = G(L); |
| 302 | luaF_close(L, L->stack, CLOSEPROTECT); /* close all upvalues */ |
| 303 | luaC_freeallobjects(L); /* collect all objects */ |
| 304 | if (ttisnil(&g->nilvalue)) /* closing a fully built state? */ |
| 305 | luai_userstateclose(L); |
| 306 | luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); |
| 307 | freestack(L); |
| 308 | lua_assert(gettotalbytes(g) == sizeof(LG)); |
| 309 | (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ |
| 310 | } |
| 311 | |
| 312 | |
| 313 | LUA_API lua_State *lua_newthread (lua_State *L) { |
no test coverage detected