| 267 | |
| 268 | |
| 269 | static void close_state (lua_State *L) { |
| 270 | global_State *g = G(L); |
| 271 | if (!completestate(g)) /* closing a partially built state? */ |
| 272 | luaC_freeallobjects(L); /* jucst collect its objects */ |
| 273 | else { /* closing a fully built state */ |
| 274 | luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */ |
| 275 | luaC_freeallobjects(L); /* collect all objects */ |
| 276 | luai_userstateclose(L); |
| 277 | } |
| 278 | luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); |
| 279 | freestack(L); |
| 280 | lua_assert(gettotalbytes(g) == sizeof(LG)); |
| 281 | (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ |
| 282 | } |
| 283 | |
| 284 | |
| 285 | LUA_API lua_State *lua_newthread (lua_State *L) { |
no test coverage detected