diff options
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -767,6 +767,7 @@ static CallInfo *findpcall (lua_State *L) { | |||
767 | ** coroutine error handler and should not kill the coroutine.) | 767 | ** coroutine error handler and should not kill the coroutine.) |
768 | */ | 768 | */ |
769 | static int resume_error (lua_State *L, const char *msg, int narg) { | 769 | static int resume_error (lua_State *L, const char *msg, int narg) { |
770 | api_checkpop(L, narg); | ||
770 | L->top.p -= narg; /* remove args from the stack */ | 771 | L->top.p -= narg; /* remove args from the stack */ |
771 | setsvalue2s(L, L->top.p, luaS_new(L, msg)); /* push error message */ | 772 | setsvalue2s(L, L->top.p, luaS_new(L, msg)); /* push error message */ |
772 | api_incr_top(L); | 773 | api_incr_top(L); |
@@ -849,7 +850,7 @@ LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs, | |||
849 | return resume_error(L, "C stack overflow", nargs); | 850 | return resume_error(L, "C stack overflow", nargs); |
850 | L->nCcalls++; | 851 | L->nCcalls++; |
851 | luai_userstateresume(L, nargs); | 852 | luai_userstateresume(L, nargs); |
852 | api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); | 853 | api_checkpop(L, (L->status == LUA_OK) ? nargs + 1 : nargs); |
853 | status = luaD_rawrunprotected(L, resume, &nargs); | 854 | status = luaD_rawrunprotected(L, resume, &nargs); |
854 | /* continue running after recoverable errors */ | 855 | /* continue running after recoverable errors */ |
855 | status = precover(L, status); | 856 | status = precover(L, status); |
@@ -878,7 +879,7 @@ LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, | |||
878 | luai_userstateyield(L, nresults); | 879 | luai_userstateyield(L, nresults); |
879 | lua_lock(L); | 880 | lua_lock(L); |
880 | ci = L->ci; | 881 | ci = L->ci; |
881 | api_checknelems(L, nresults); | 882 | api_checkpop(L, nresults); |
882 | if (l_unlikely(!yieldable(L))) { | 883 | if (l_unlikely(!yieldable(L))) { |
883 | if (L != G(L)->mainthread) | 884 | if (L != G(L)->mainthread) |
884 | luaG_runerror(L, "attempt to yield across a C-call boundary"); | 885 | luaG_runerror(L, "attempt to yield across a C-call boundary"); |