aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lstate.c b/lstate.c
index c708a162..52336f44 100644
--- a/lstate.c
+++ b/lstate.c
@@ -226,8 +226,6 @@ static void init_registry (lua_State *L, global_State *g) {
226 226
227/* 227/*
228** open parts of the state that may cause memory-allocation errors. 228** open parts of the state that may cause memory-allocation errors.
229** ('g->nilvalue' being a nil value flags that the state was completely
230** build.)
231*/ 229*/
232static void f_luaopen (lua_State *L, void *ud) { 230static void f_luaopen (lua_State *L, void *ud) {
233 global_State *g = G(L); 231 global_State *g = G(L);
@@ -238,7 +236,7 @@ static void f_luaopen (lua_State *L, void *ud) {
238 luaT_init(L); 236 luaT_init(L);
239 luaX_init(L); 237 luaX_init(L);
240 g->gcrunning = 1; /* allow gc */ 238 g->gcrunning = 1; /* allow gc */
241 setnilvalue(&g->nilvalue); 239 setnilvalue(&g->nilvalue); /* now state is complete */
242 luai_userstateopen(L); 240 luai_userstateopen(L);
243} 241}
244 242
@@ -272,7 +270,7 @@ static void close_state (lua_State *L) {
272 global_State *g = G(L); 270 global_State *g = G(L);
273 luaD_closeprotected(L, 0, LUA_OK); /* close all upvalues */ 271 luaD_closeprotected(L, 0, LUA_OK); /* close all upvalues */
274 luaC_freeallobjects(L); /* collect all objects */ 272 luaC_freeallobjects(L); /* collect all objects */
275 if (ttisnil(&g->nilvalue)) /* closing a fully built state? */ 273 if (completestate(g)) /* closing a fully built state? */
276 luai_userstateclose(L); 274 luai_userstateclose(L);
277 luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); 275 luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size);
278 freestack(L); 276 freestack(L);