A coroutine can close itself
A call to close itself will close all its to-be-closed variables and return to the resume that (re)started the coroutine.
This commit is contained in:
2
lstate.c
2
lstate.c
@@ -326,6 +326,8 @@ LUA_API int lua_closethread (lua_State *L, lua_State *from) {
|
||||
lua_lock(L);
|
||||
L->nCcalls = (from) ? getCcalls(from) : 0;
|
||||
status = luaE_resetthread(L, L->status);
|
||||
if (L == from) /* closing itself? */
|
||||
luaD_throwbaselevel(L, status);
|
||||
lua_unlock(L);
|
||||
return APIstatus(status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user