diff options
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.56 2002/06/06 12:40:36 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.57 2002/06/13 13:44: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 | */ |
@@ -185,10 +185,7 @@ static int errorfb (lua_State *L) { | |||
185 | int level = 1; /* skip level 0 (it's this function) */ | 185 | int level = 1; /* skip level 0 (it's this function) */ |
186 | int firstpart = 1; /* still before eventual `...' */ | 186 | int firstpart = 1; /* still before eventual `...' */ |
187 | lua_Debug ar; | 187 | lua_Debug ar; |
188 | if (!lua_isstring(L, 1)) | 188 | lua_settop(L, 0); |
189 | return lua_gettop(L); | ||
190 | lua_settop(L, 1); | ||
191 | lua_pushliteral(L, "\n"); | ||
192 | lua_pushliteral(L, "stack traceback:\n"); | 189 | lua_pushliteral(L, "stack traceback:\n"); |
193 | while (lua_getstack(L, level++, &ar)) { | 190 | while (lua_getstack(L, level++, &ar)) { |
194 | char buff[10]; | 191 | char buff[10]; |
@@ -242,13 +239,16 @@ static const luaL_reg dblib[] = { | |||
242 | {"setlinehook", setlinehook}, | 239 | {"setlinehook", setlinehook}, |
243 | {"setlocal", setlocal}, | 240 | {"setlocal", setlocal}, |
244 | {"debug", debug}, | 241 | {"debug", debug}, |
242 | {"traceback", errorfb}, | ||
245 | {NULL, NULL} | 243 | {NULL, NULL} |
246 | }; | 244 | }; |
247 | 245 | ||
248 | 246 | ||
249 | LUALIB_API int lua_dblibopen (lua_State *L) { | 247 | LUALIB_API int lua_dblibopen (lua_State *L) { |
250 | luaL_opennamedlib(L, LUA_DBLIBNAME, dblib, 0); | 248 | luaL_opennamedlib(L, LUA_DBLIBNAME, dblib, 0); |
251 | lua_register(L, "_ERRORMESSAGE", errorfb); | 249 | lua_pushliteral(L, LUA_TRACEBACK); |
250 | lua_pushcfunction(L, errorfb); | ||
251 | lua_settable(L, LUA_REGISTRYINDEX); | ||
252 | return 0; | 252 | return 0; |
253 | } | 253 | } |
254 | 254 | ||