aboutsummaryrefslogtreecommitdiff
path: root/ldblib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-01 17:48:12 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-01 17:48:12 -0300
commit751cd867d3e0338279fa6f3390c8b7ddc0108659 (patch)
tree726f6f3cd49109382b2c0d7ee6a1e0fea740afbd /ldblib.c
parentb36b2a061c88be22e36900146cbcad39bab07f5d (diff)
downloadlua-751cd867d3e0338279fa6f3390c8b7ddc0108659.tar.gz
lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.tar.bz2
lua-751cd867d3e0338279fa6f3390c8b7ddc0108659.zip
new way to handle errors
Diffstat (limited to 'ldblib.c')
-rw-r--r--ldblib.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/ldblib.c b/ldblib.c
index c38cf419..4e565256 100644
--- a/ldblib.c
+++ b/ldblib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldblib.c,v 1.47 2002/04/09 19:48:08 roberto Exp roberto $ 2** $Id: ldblib.c,v 1.48 2002/04/22 14:40:50 roberto Exp roberto $
3** Interface from Lua to its debug API 3** Interface from Lua to its debug API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -189,7 +189,6 @@ static int errorfb (lua_State *L) {
189 lua_Debug ar; 189 lua_Debug ar;
190 luaL_Buffer b; 190 luaL_Buffer b;
191 luaL_buffinit(L, &b); 191 luaL_buffinit(L, &b);
192 luaL_addstring(&b, "error: ");
193 luaL_addstring(&b, luaL_check_string(L, 1)); 192 luaL_addstring(&b, luaL_check_string(L, 1));
194 luaL_addstring(&b, "\n"); 193 luaL_addstring(&b, "\n");
195 while (lua_getstack(L, level++, &ar)) { 194 while (lua_getstack(L, level++, &ar)) {
@@ -243,12 +242,7 @@ static int errorfb (lua_State *L) {
243 luaL_addstring(&b, "\n"); 242 luaL_addstring(&b, "\n");
244 } 243 }
245 luaL_pushresult(&b); 244 luaL_pushresult(&b);
246 lua_getglobal(L, LUA_ALERT); 245 return 1;
247 if (lua_isfunction(L, -1)) { /* avoid loop if _ALERT is not defined */
248 lua_pushvalue(L, -2); /* error message */
249 lua_rawcall(L, 1, 0);
250 }
251 return 0;
252} 246}
253 247
254 248