aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-18 12:19:27 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-06-18 12:19:27 -0300
commit1dbe708aa84f3a1e51daf8d7e2f714e2b02f554b (patch)
treee845de9ee24b94362146e38410ae0670df18526b /lapi.c
parent8f080fd683d63b0cd4b38380f6a5bdae5d6e2584 (diff)
downloadlua-1dbe708aa84f3a1e51daf8d7e2f714e2b02f554b.tar.gz
lua-1dbe708aa84f3a1e51daf8d7e2f714e2b02f554b.tar.bz2
lua-1dbe708aa84f3a1e51daf8d7e2f714e2b02f554b.zip
new protocol for error handling
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lapi.c b/lapi.c
index d2600972..0d27a7e8 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.198 2002/06/13 13:39:55 roberto Exp roberto $ 2** $Id: lapi.c,v 1.199 2002/06/13 13:44:50 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*/
@@ -565,12 +565,10 @@ LUA_API void lua_upcall (lua_State *L, int nargs, int nresults) {
565} 565}
566 566
567 567
568LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errf) { 568LUA_API int lua_pcall (lua_State *L, int nargs, int nresults) {
569 int status; 569 int status;
570 const TObject *err;
571 lua_lock(L); 570 lua_lock(L);
572 err = (errf == 0) ? &luaO_nilobject : luaA_index(L, errf); 571 status = luaD_pcall(L, nargs, nresults);
573 status = luaD_pcall(L, nargs, nresults, err);
574 lua_unlock(L); 572 lua_unlock(L);
575 return status; 573 return status;
576} 574}
@@ -631,10 +629,10 @@ LUA_API void lua_setgcthreshold (lua_State *L, int newthreshold) {
631*/ 629*/
632 630
633 631
634LUA_API int lua_errorobj (lua_State *L) { 632LUA_API int lua_error (lua_State *L) {
635 lua_lock(L); 633 lua_lock(L);
636 api_checknelems(L, 1); 634 api_checknelems(L, 1);
637 luaD_errorobj(L, L->top - 1, LUA_ERRRUN); 635 luaG_errormsg(L, 0);
638 lua_unlock(L); 636 lua_unlock(L);
639 return 0; /* to avoid warnings */ 637 return 0; /* to avoid warnings */
640} 638}