diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.205 2002/07/17 16:25:13 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.206 2002/08/05 14:43:38 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 | */ |
@@ -610,22 +610,17 @@ LUA_API void lua_call (lua_State *L, int nargs, int nresults) { | |||
610 | } | 610 | } |
611 | 611 | ||
612 | 612 | ||
613 | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults) { | 613 | LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { |
614 | int status; | 614 | int status; |
615 | ptrdiff_t func; | ||
615 | lua_lock(L); | 616 | lua_lock(L); |
616 | status = luaD_pcall(L, nargs, nresults); | 617 | func = (errfunc == 0) ? 0 : savestack(L, luaA_index(L, errfunc)); |
618 | status = luaD_pcall(L, nargs, nresults, func); | ||
617 | lua_unlock(L); | 619 | lua_unlock(L); |
618 | return status; | 620 | return status; |
619 | } | 621 | } |
620 | 622 | ||
621 | 623 | ||
622 | LUA_API void lua_pcallreset (lua_State *L) { | ||
623 | lua_lock(L); | ||
624 | luaD_resetprotection(L); /* reset error handler */ | ||
625 | lua_unlock(L); | ||
626 | } | ||
627 | |||
628 | |||
629 | LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, | 624 | LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, |
630 | const char *chunkname) { | 625 | const char *chunkname) { |
631 | ZIO z; | 626 | ZIO z; |