aboutsummaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-05 14:36:24 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-08-05 14:36:24 -0300
commit4e23699aa647fd9dc04933bf5582217ca594c8ce (patch)
tree03d4f407c2f8974a62837a7d71f417c833aedd99 /lauxlib.c
parent1c0ac3c0f53720c53dcfae13308b11b29dca38e4 (diff)
downloadlua-4e23699aa647fd9dc04933bf5582217ca594c8ce.tar.gz
lua-4e23699aa647fd9dc04933bf5582217ca594c8ce.tar.bz2
lua-4e23699aa647fd9dc04933bf5582217ca594c8ce.zip
new implementation for error handling
Diffstat (limited to 'lauxlib.c')
-rw-r--r--lauxlib.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/lauxlib.c b/lauxlib.c
index d66250b3..01bcf9a1 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lauxlib.c,v 1.77 2002/06/26 19:28:44 roberto Exp roberto $ 2** $Id: lauxlib.c,v 1.78 2002/07/01 19:23:58 roberto Exp $
3** Auxiliary functions for building Lua libraries 3** Auxiliary functions for building Lua libraries
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -394,21 +394,20 @@ LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size,
394 394
395static void callalert (lua_State *L, int status) { 395static void callalert (lua_State *L, int status) {
396 if (status != 0) { 396 if (status != 0) {
397 int top;
398 if (status == LUA_ERRRUN)
399 lua_concat(L, 2); /* concat error message and traceback */
400 top = lua_gettop(L);
401 lua_getglobal(L, "_ALERT"); 397 lua_getglobal(L, "_ALERT");
402 lua_insert(L, -2); 398 lua_insert(L, -2);
403 lua_pcall(L, 1, 0); 399 lua_call(L, 1, 0);
404 lua_settop(L, top-1); 400 lua_pop(L, 1);
405 } 401 }
406} 402}
407 403
408 404
409static int aux_do (lua_State *L, int status) { 405static int aux_do (lua_State *L, int status) {
410 if (status == 0) /* parse OK? */ 406 if (status == 0) { /* parse OK? */
411 status = lua_pcall(L, 0, LUA_MULTRET); /* call main */ 407 status = lua_pcall(L, 0, LUA_MULTRET); /* call main */
408 if (status != 0)
409 lua_pcallreset(L);
410 }
412 callalert(L, status); 411 callalert(L, status);
413 return status; 412 return status;
414} 413}