diff options
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 18 |
1 files changed, 9 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.273 2017/11/02 11:28:56 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.274 2017/11/03 12:12:30 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -948,8 +948,8 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, | |||
| 948 | checkresults(L, nargs, nresults); | 948 | checkresults(L, nargs, nresults); |
| 949 | func = L->top - (nargs+1); | 949 | func = L->top - (nargs+1); |
| 950 | if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ | 950 | if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ |
| 951 | L->ci->u.c.k = k; /* save continuation */ | 951 | L->func->stkci.u.c.k = k; /* save continuation */ |
| 952 | L->ci->u.c.ctx = ctx; /* save context */ | 952 | L->func->stkci.u.c.ctx = ctx; /* save context */ |
| 953 | luaD_call(L, func, nresults); /* do the call */ | 953 | luaD_call(L, func, nresults); /* do the call */ |
| 954 | } | 954 | } |
| 955 | else /* no continuation or no yieldable */ | 955 | else /* no continuation or no yieldable */ |
| @@ -999,19 +999,19 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, | |||
| 999 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), efunc); | 999 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), efunc); |
| 1000 | } | 1000 | } |
| 1001 | else { /* prepare continuation (call is already protected by 'resume') */ | 1001 | else { /* prepare continuation (call is already protected by 'resume') */ |
| 1002 | CallInfo *ci = L->ci; | ||
| 1003 | StkId func = L->func; | 1002 | StkId func = L->func; |
| 1004 | ci->u.c.k = k; /* save continuation */ | 1003 | func->stkci.u.c.k = k; /* save continuation */ |
| 1005 | ci->u.c.ctx = ctx; /* save context */ | 1004 | func->stkci.u.c.ctx = ctx; /* save context */ |
| 1006 | /* save information for error recovery */ | 1005 | /* save information for error recovery */ |
| 1007 | ci->u2.funcidx = savestack(L, c.func); | 1006 | func->stkci.u2.funcidx = c.func - func; |
| 1008 | ci->u.c.old_errfunc = L->errfunc; | 1007 | func->stkci.u.c.old_errfunc = L->errfunc; |
| 1009 | L->errfunc = efunc; | 1008 | L->errfunc = efunc; |
| 1010 | setoah(callstatus(func), L->allowhook); /* save value of 'allowhook' */ | 1009 | setoah(callstatus(func), L->allowhook); /* save value of 'allowhook' */ |
| 1011 | callstatus(func) |= CIST_YPCALL; /* function can do error recovery */ | 1010 | callstatus(func) |= CIST_YPCALL; /* function can do error recovery */ |
| 1012 | luaD_call(L, c.func, nresults); /* do the call */ | 1011 | luaD_call(L, c.func, nresults); /* do the call */ |
| 1012 | func = L->func; /* previous call can reallocate stack */ | ||
| 1013 | callstatus(func) &= ~CIST_YPCALL; | 1013 | callstatus(func) &= ~CIST_YPCALL; |
| 1014 | L->errfunc = ci->u.c.old_errfunc; | 1014 | L->errfunc = func->stkci.u.c.old_errfunc; |
| 1015 | status = LUA_OK; /* if it is here, there were no errors */ | 1015 | status = LUA_OK; /* if it is here, there were no errors */ |
| 1016 | } | 1016 | } |
| 1017 | adjustresults(L, nresults); | 1017 | adjustresults(L, nresults); |
