diff options
Diffstat (limited to '')
-rw-r--r-- | lstate.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -272,7 +272,9 @@ static void close_state (lua_State *L) { | |||
272 | luaC_freeallobjects(L); /* just collect its objects */ | 272 | luaC_freeallobjects(L); /* just collect its objects */ |
273 | else { /* closing a fully built state */ | 273 | else { /* closing a fully built state */ |
274 | L->ci = &L->base_ci; /* unwind CallInfo list */ | 274 | L->ci = &L->base_ci; /* unwind CallInfo list */ |
275 | L->errfunc = 0; /* stack unwind can "throw away" the error function */ | ||
275 | luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */ | 276 | luaD_closeprotected(L, 1, LUA_OK); /* close all upvalues */ |
277 | L->top.p = L->stack.p + 1; /* empty the stack to run finalizers */ | ||
276 | luaC_freeallobjects(L); /* collect all objects */ | 278 | luaC_freeallobjects(L); /* collect all objects */ |
277 | luai_userstateclose(L); | 279 | luai_userstateclose(L); |
278 | } | 280 | } |
@@ -328,6 +330,7 @@ int luaE_resetthread (lua_State *L, int status) { | |||
328 | if (status == LUA_YIELD) | 330 | if (status == LUA_YIELD) |
329 | status = LUA_OK; | 331 | status = LUA_OK; |
330 | L->status = LUA_OK; /* so it can run __close metamethods */ | 332 | L->status = LUA_OK; /* so it can run __close metamethods */ |
333 | L->errfunc = 0; /* stack unwind can "throw away" the error function */ | ||
331 | status = luaD_closeprotected(L, 1, status); | 334 | status = luaD_closeprotected(L, 1, status); |
332 | if (status != LUA_OK) /* errors? */ | 335 | if (status != LUA_OK) /* errors? */ |
333 | luaD_seterrorobj(L, status, L->stack.p + 1); | 336 | luaD_seterrorobj(L, status, L->stack.p + 1); |