From a93e0144479f1eb0ac19b8c31862f4cbc2fbe1c4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 10 Apr 2019 13:23:14 -0300 Subject: Added an optional parameter to 'coroutine.isyieldable' --- lcorolib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lcorolib.c') diff --git a/lcorolib.c b/lcorolib.c index cdb5fedc..f7c9e165 100644 --- a/lcorolib.c +++ b/lcorolib.c @@ -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; } -- cgit v1.2.3-55-g6feb