New functions 'lua_resetthread' and 'coroutine.kill'

New functions to reset/kill a thread/coroutine, mainly (only?) to
close any pending to-be-closed variable. ('lua_resetthread' also
allows a thread to be reused...)
This commit is contained in:
Roberto Ierusalimschy
2018-12-13 13:07:53 -02:00
parent 3b06f983ae
commit fdc25a1ebf
11 changed files with 195 additions and 32 deletions

View File

@@ -1366,6 +1366,9 @@ static int runC (lua_State *L, lua_State *L1, const char *pc) {
else if EQ("newthread") {
lua_newthread(L1);
}
else if EQ("resetthread") {
lua_pushinteger(L1, lua_resetthread(L1));
}
else if EQ("newuserdata") {
lua_newuserdata(L1, getnum);
}