Added an optional parameter to 'coroutine.isyieldable'

This commit is contained in:
Roberto Ierusalimschy
2019-04-10 13:23:14 -03:00
parent 8ba4523ccc
commit a93e014447
3 changed files with 11 additions and 6 deletions

View File

@@ -146,7 +146,8 @@ static int luaB_costatus (lua_State *L) {
static int luaB_yieldable (lua_State *L) {
lua_pushboolean(L, lua_isyieldable(L));
lua_State *co = lua_isnone(L, 1) ? L : getco(L);
lua_pushboolean(L, lua_isyieldable(co));
return 1;
}