MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / close_state

Function close_state

lib/lua/src/lstate.c:269–283  ·  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 luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */
276 luaC_freeallobjects(L); /* collect all objects */
277 luai_userstateclose(L);
278 }
279 luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
280 freestack(L);
281 lua_assert(gettotalbytes(g) == sizeof(LG));
282 (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */
283}
284
285
286LUA_API lua_State *lua_newthread (lua_State *L) {

Callers 2

lua_newstateFunction · 0.85
lua_closeFunction · 0.85

Calls 4

luaC_freeallobjectsFunction · 0.85
luaD_closeprotectedFunction · 0.85
freestackFunction · 0.85
GFunction · 0.50

Tested by

no test coverage detected