aboutsummaryrefslogtreecommitdiff
path: root/lcorolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-11-02 09:28:56 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-11-02 09:28:56 -0200
commitba36180fd7b68341ad57e0fbe7a55cdfb334908d (patch)
treec99f2d1335c90aad7015475e64cecbea889cefcc /lcorolib.c
parentb9e76be8a691ed83a716a85c6b85cb80f66cc480 (diff)
downloadlua-ba36180fd7b68341ad57e0fbe7a55cdfb334908d.tar.gz
lua-ba36180fd7b68341ad57e0fbe7a55cdfb334908d.tar.bz2
lua-ba36180fd7b68341ad57e0fbe7a55cdfb334908d.zip
new API for 'lua_resume' + cleaning the uses of the 'extra' field in
'CallInfo'
Diffstat (limited to 'lcorolib.c')
-rw-r--r--lcorolib.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lcorolib.c b/lcorolib.c
index 95467264..49a3cf28 100644
--- a/lcorolib.c
+++ b/lcorolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lcorolib.c,v 1.9 2014/11/02 19:19:04 roberto Exp roberto $ 2** $Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp roberto $
3** Coroutine Library 3** Coroutine Library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -26,7 +26,7 @@ static lua_State *getco (lua_State *L) {
26 26
27 27
28static int auxresume (lua_State *L, lua_State *co, int narg) { 28static int auxresume (lua_State *L, lua_State *co, int narg) {
29 int status; 29 int status, nres;
30 if (!lua_checkstack(co, narg)) { 30 if (!lua_checkstack(co, narg)) {
31 lua_pushliteral(L, "too many arguments to resume"); 31 lua_pushliteral(L, "too many arguments to resume");
32 return -1; /* error flag */ 32 return -1; /* error flag */
@@ -36,9 +36,8 @@ static int auxresume (lua_State *L, lua_State *co, int narg) {
36 return -1; /* error flag */ 36 return -1; /* error flag */
37 } 37 }
38 lua_xmove(L, co, narg); 38 lua_xmove(L, co, narg);
39 status = lua_resume(co, L, narg); 39 status = lua_resume(co, L, narg, &nres);
40 if (status == LUA_OK || status == LUA_YIELD) { 40 if (status == LUA_OK || status == LUA_YIELD) {
41 int nres = lua_gettop(co);
42 if (!lua_checkstack(L, nres + 1)) { 41 if (!lua_checkstack(L, nres + 1)) {
43 lua_pop(co, nres); /* remove results anyway */ 42 lua_pop(co, nres); /* remove results anyway */
44 lua_pushliteral(L, "too many results to resume"); 43 lua_pushliteral(L, "too many results to resume");