diff options
Diffstat (limited to 'ldblib.c')
-rw-r--r-- | ldblib.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.67 2002/08/12 17:23:12 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.68 2002/08/16 14:45:18 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 | */ |
@@ -198,21 +198,21 @@ static int errorfb (lua_State *L) { | |||
198 | if (lua_gettop(L) == 0) | 198 | if (lua_gettop(L) == 0) |
199 | lua_pushliteral(L, ""); | 199 | lua_pushliteral(L, ""); |
200 | else if (!lua_isstring(L, 1)) return 1; /* no string message */ | 200 | else if (!lua_isstring(L, 1)) return 1; /* no string message */ |
201 | lua_pushliteral(L, "stack traceback:\n"); | 201 | lua_pushliteral(L, "\nstack traceback:"); |
202 | while (lua_getstack(L, level++, &ar)) { | 202 | while (lua_getstack(L, level++, &ar)) { |
203 | if (level > LEVELS1 && firstpart) { | 203 | if (level > LEVELS1 && firstpart) { |
204 | /* no more than `LEVELS2' more levels? */ | 204 | /* no more than `LEVELS2' more levels? */ |
205 | if (!lua_getstack(L, level+LEVELS2, &ar)) | 205 | if (!lua_getstack(L, level+LEVELS2, &ar)) |
206 | level--; /* keep going */ | 206 | level--; /* keep going */ |
207 | else { | 207 | else { |
208 | lua_pushliteral(L, "\t...\n"); /* too many levels */ | 208 | lua_pushliteral(L, "\n\t..."); /* too many levels */ |
209 | while (lua_getstack(L, level+LEVELS2, &ar)) /* find last levels */ | 209 | while (lua_getstack(L, level+LEVELS2, &ar)) /* find last levels */ |
210 | level++; | 210 | level++; |
211 | } | 211 | } |
212 | firstpart = 0; | 212 | firstpart = 0; |
213 | continue; | 213 | continue; |
214 | } | 214 | } |
215 | lua_pushliteral(L, "\t"); | 215 | lua_pushliteral(L, "\n\t"); |
216 | lua_getinfo(L, "Snl", &ar); | 216 | lua_getinfo(L, "Snl", &ar); |
217 | lua_pushfstring(L, "%s:", ar.short_src); | 217 | lua_pushfstring(L, "%s:", ar.short_src); |
218 | if (ar.currentline > 0) | 218 | if (ar.currentline > 0) |
@@ -234,7 +234,6 @@ static int errorfb (lua_State *L) { | |||
234 | ar.short_src, ar.linedefined); | 234 | ar.short_src, ar.linedefined); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | lua_pushliteral(L, "\n"); | ||
238 | lua_concat(L, lua_gettop(L)); | 237 | lua_concat(L, lua_gettop(L)); |
239 | } | 238 | } |
240 | lua_concat(L, lua_gettop(L)); | 239 | lua_concat(L, lua_gettop(L)); |