From a2fa48a570b01b2a2cd37f01799f08f693fc5892 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 6 Aug 2002 12:32:22 -0300 Subject: new (old?) error handling scheme --- lapi.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'lapi.c') diff --git a/lapi.c b/lapi.c index 7d1831c8..d7b8c376 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.205 2002/07/17 16:25:13 roberto Exp roberto $ +** $Id: lapi.c,v 1.206 2002/08/05 14:43:38 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -610,22 +610,17 @@ LUA_API void lua_call (lua_State *L, int nargs, int nresults) { } -LUA_API int lua_pcall (lua_State *L, int nargs, int nresults) { +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { int status; + ptrdiff_t func; lua_lock(L); - status = luaD_pcall(L, nargs, nresults); + func = (errfunc == 0) ? 0 : savestack(L, luaA_index(L, errfunc)); + status = luaD_pcall(L, nargs, nresults, func); lua_unlock(L); return status; } -LUA_API void lua_pcallreset (lua_State *L) { - lua_lock(L); - luaD_resetprotection(L); /* reset error handler */ - lua_unlock(L); -} - - LUA_API int lua_load (lua_State *L, lua_Chunkreader reader, void *data, const char *chunkname) { ZIO z; -- cgit v1.2.3-55-g6feb