Skip to content

Commit

Permalink
From Lua 5.3: Add lua_isyieldable().
Browse files Browse the repository at this point in the history
Contributed by François Perrad.
  • Loading branch information
Mike Pall authored and lukego committed Aug 13, 2017
1 parent f1264bf commit 9a520cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lj_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,11 @@ LUALIB_API int luaL_callmeta(lua_State *L, int idx, const char *field)

/* -- Coroutine yield and resume ------------------------------------------ */

LUA_API int lua_isyieldable(lua_State *L)
{
return cframe_canyield(L->cframe);
}

LUA_API int lua_yield(lua_State *L, int nresults)
{
void *cf = L->cframe;
Expand Down
3 changes: 3 additions & 0 deletions src/lua.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,9 @@ LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt,
LUA_API const lua_Number *lua_version (lua_State *L);
LUA_API void lua_copy (lua_State *L, int fromidx, int toidx);

/* From Lua 5.3. */
LUA_API int lua_isyieldable (lua_State *L);


struct lua_Debug {
int event;
Expand Down

0 comments on commit 9a520cb

Please sign in to comment.