diff options
Diffstat (limited to '')
| -rw-r--r-- | lcorolib.c | 3 |
1 files changed, 3 insertions, 0 deletions
| @@ -190,6 +190,9 @@ static int luaB_close (lua_State *L) { | |||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | case COS_RUN: /* running coroutine? */ | 192 | case COS_RUN: /* running coroutine? */ |
| 193 | lua_geti(L, LUA_REGISTRYINDEX, LUA_RIDX_MAINTHREAD); /* get main */ | ||
| 194 | if (lua_tothread(L, -1) == co) | ||
| 195 | return luaL_error(L, "cannot close main thread"); | ||
| 193 | lua_closethread(co, L); /* close itself */ | 196 | lua_closethread(co, L); /* close itself */ |
| 194 | lua_assert(0); /* previous call does not return */ | 197 | lua_assert(0); /* previous call does not return */ |
| 195 | return 0; | 198 | return 0; |
