aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/liolib.c b/liolib.c
index 1de1b79f..ed40b1ac 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 1.29 1999/01/04 12:41:12 roberto Exp roberto $ 2** $Id: liolib.c,v 1.30 1999/02/05 15:22:43 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -459,7 +459,7 @@ static void errorfb (void) {
459 char buff[MAXMESSAGE]; 459 char buff[MAXMESSAGE];
460 int level = 1; /* skip level 0 (it's this function) */ 460 int level = 1; /* skip level 0 (it's this function) */
461 lua_Object func; 461 lua_Object func;
462 sprintf(buff, "lua: %.200s\n", lua_getstring(lua_getparam(1))); 462 sprintf(buff, "lua error: %.200s\n", lua_getstring(lua_getparam(1)));
463 while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) { 463 while ((func = lua_stackedfunction(level++)) != LUA_NOOBJECT) {
464 char *name; 464 char *name;
465 int currentline; 465 int currentline;
@@ -496,8 +496,11 @@ static void errorfb (void) {
496 sprintf(buff+strlen(buff), " [in chunk %.50s]", chunkname); 496 sprintf(buff+strlen(buff), " [in chunk %.50s]", chunkname);
497 strcat(buff, "\n"); 497 strcat(buff, "\n");
498 } 498 }
499 lua_pushstring(buff); 499 func = lua_rawgetglobal("_ALERT");
500 lua_call("_ALERT"); 500 if (lua_isfunction(func)) { /* avoid error loop if _ALERT is not defined */
501 lua_pushstring(buff);
502 lua_callfunction(func);
503 }
501} 504}
502 505
503 506