MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / close_state

Function close_state

third-party/lua-5.4.6/src/lstate.c:269–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267
268
269static 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); /* just collect its objects */
273 else { /* closing a fully built state */
274 L->ci = &L->base_ci; /* unwind CallInfo list */
275 L->errfunc = 0; /* stack unwind can "throw away" the error function */
276 luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */
277 L->top.p = L->stack.p + 1; /* empty the stack to run finalizers */
278 luaC_freeallobjects(L); /* collect all objects */
279 luai_userstateclose(L);
280 }
281 luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
282 freestack(L);
283 lua_assert(gettotalbytes(g) == sizeof(LG));
284 (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */
285}
286
287
288LUA_API lua_State *lua_newthread (lua_State *L) {

Callers 2

lua_newstateFunction · 0.70
lua_closeFunction · 0.70

Calls 3

luaC_freeallobjectsFunction · 0.70
luaD_closeprotectedFunction · 0.70
freestackFunction · 0.70

Tested by

no test coverage detected