diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-04-17 19:00:01 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-04-17 19:00:01 -0300 |
commit | d3037d97ec192e7719de485f15dacb473bf96528 (patch) | |
tree | ea9f837cc64d9df82ae4324f2c7ea447b5c4582f /lapi.c | |
parent | c6b442bd369ce05b3d4bfb95ba64451521aa1b31 (diff) | |
download | lua-d3037d97ec192e7719de485f15dacb473bf96528.tar.gz lua-d3037d97ec192e7719de485f15dacb473bf96528.tar.bz2 lua-d3037d97ec192e7719de485f15dacb473bf96528.zip |
several small improvements based on 'ci' being fixed now (including
erasing savedpc from lua_State)
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 19 |
1 files changed, 10 insertions, 9 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.74 2009/04/08 18:04:33 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.75 2009/04/17 14:28:06 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 | */ |
@@ -829,18 +829,19 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, | |||
829 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); | 829 | status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); |
830 | } | 830 | } |
831 | else { /* prepare continuation (call is already protected by 'resume') */ | 831 | else { /* prepare continuation (call is already protected by 'resume') */ |
832 | L->ci->u.c.k = k; /* save continuation */ | 832 | CallInfo *ci = L->ci; |
833 | L->ci->u.c.ctx = ctx; /* save context */ | 833 | ci->u.c.k = k; /* save continuation */ |
834 | ci->u.c.ctx = ctx; /* save context */ | ||
834 | /* save information for error recovery */ | 835 | /* save information for error recovery */ |
835 | L->ci->u.c.oldtop = savestack(L, c.func); | 836 | ci->u.c.oldtop = savestack(L, c.func); |
836 | L->ci->u.c.old_allowhook = L->allowhook; | 837 | ci->u.c.old_allowhook = L->allowhook; |
837 | L->ci->u.c.old_errfunc = L->errfunc; | 838 | ci->u.c.old_errfunc = L->errfunc; |
838 | L->errfunc = func; | 839 | L->errfunc = func; |
839 | /* mark that function may do error recovery */ | 840 | /* mark that function may do error recovery */ |
840 | L->ci->callstatus |= CIST_YPCALL; | 841 | ci->callstatus |= CIST_YPCALL; |
841 | luaD_call(L, c.func, nresults, 1); /* do the call */ | 842 | luaD_call(L, c.func, nresults, 1); /* do the call */ |
842 | L->ci->callstatus &= ~CIST_YPCALL; | 843 | ci->callstatus &= ~CIST_YPCALL; |
843 | L->errfunc = L->ci->u.c.old_errfunc; | 844 | L->errfunc = ci->u.c.old_errfunc; |
844 | status = LUA_OK; /* if it is here, there were no errors */ | 845 | status = LUA_OK; /* if it is here, there were no errors */ |
845 | } | 846 | } |
846 | adjustresults(L, nresults); | 847 | adjustresults(L, nresults); |