diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-05-08 10:52:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-05-08 10:52:20 -0300 |
commit | 1bd70a8e40a8600658c706d5f171138e9b902aba (patch) | |
tree | 9b4408457bbd03a3fda83b21bbf54dba56234d08 /ldo.c | |
parent | ef83457427cdb2d9f29d94177131db8e6e2eb606 (diff) | |
download | lua-1bd70a8e40a8600658c706d5f171138e9b902aba.tar.gz lua-1bd70a8e40a8600658c706d5f171138e9b902aba.tar.bz2 lua-1bd70a8e40a8600658c706d5f171138e9b902aba.zip |
new function 'lua_isyieldable' (and 'coroutine.isyieldable')
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.114 2014/02/26 15:27:56 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.115 2014/03/21 13:52:33 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -571,6 +571,11 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { | |||
571 | } | 571 | } |
572 | 572 | ||
573 | 573 | ||
574 | LUA_API int lua_isyieldable (lua_State *L) { | ||
575 | return (L->nny == 0); | ||
576 | } | ||
577 | |||
578 | |||
574 | LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) { | 579 | LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) { |
575 | CallInfo *ci = L->ci; | 580 | CallInfo *ci = L->ci; |
576 | luai_userstateyield(L, nresults); | 581 | luai_userstateyield(L, nresults); |