From ba36180fd7b68341ad57e0fbe7a55cdfb334908d Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 2 Nov 2017 09:28:56 -0200 Subject: new API for 'lua_resume' + cleaning the uses of the 'extra' field in 'CallInfo' --- lcorolib.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lcorolib.c') diff --git a/lcorolib.c b/lcorolib.c index 95467264..49a3cf28 100644 --- a/lcorolib.c +++ b/lcorolib.c @@ -1,5 +1,5 @@ /* -** $Id: lcorolib.c,v 1.9 2014/11/02 19:19:04 roberto Exp roberto $ +** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp roberto $ ** Coroutine Library ** See Copyright Notice in lua.h */ @@ -26,7 +26,7 @@ static lua_State *getco (lua_State *L) { static int auxresume (lua_State *L, lua_State *co, int narg) { - int status; + int status, nres; if (!lua_checkstack(co, narg)) { lua_pushliteral(L, "too many arguments to resume"); return -1; /* error flag */ @@ -36,9 +36,8 @@ static int auxresume (lua_State *L, lua_State *co, int narg) { return -1; /* error flag */ } lua_xmove(L, co, narg); - status = lua_resume(co, L, narg); + status = lua_resume(co, L, narg, &nres); if (status == LUA_OK || status == LUA_YIELD) { - int nres = lua_gettop(co); if (!lua_checkstack(L, nres + 1)) { lua_pop(co, nres); /* remove results anyway */ lua_pushliteral(L, "too many results to resume"); -- cgit v1.2.3-55-g6feb