diff options
-rw-r--r-- | ldblib.c | 26 |
1 files changed, 10 insertions, 16 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldblib.c,v 1.85 2004/04/30 20:13:38 roberto Exp roberto $ | 2 | ** $Id: ldblib.c,v 1.86 2004/05/31 19:27:14 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 | */ |
@@ -303,22 +303,16 @@ static int errorfb (lua_State *L) { | |||
303 | lua_pushfstring(L, "%s:", ar.short_src); | 303 | lua_pushfstring(L, "%s:", ar.short_src); |
304 | if (ar.currentline > 0) | 304 | if (ar.currentline > 0) |
305 | lua_pushfstring(L, "%d:", ar.currentline); | 305 | lua_pushfstring(L, "%d:", ar.currentline); |
306 | switch (*ar.namewhat) { | 306 | if (*ar.namewhat != '\0') /* is there a name? */ |
307 | case 'g': /* global */ | ||
308 | case 'l': /* local */ | ||
309 | case 'f': /* field */ | ||
310 | case 'm': /* method */ | ||
311 | lua_pushfstring(L, " in function `%s'", ar.name); | 307 | lua_pushfstring(L, " in function `%s'", ar.name); |
312 | break; | 308 | else { |
313 | default: { | 309 | if (*ar.what == 'm') /* main? */ |
314 | if (*ar.what == 'm') /* main? */ | 310 | lua_pushfstring(L, " in main chunk"); |
315 | lua_pushfstring(L, " in main chunk"); | 311 | else if (*ar.what == 'C' || *ar.what == 't') |
316 | else if (*ar.what == 'C' || *ar.what == 't') | 312 | lua_pushliteral(L, " ?"); /* C function or tail call */ |
317 | lua_pushliteral(L, " ?"); /* C function or tail call */ | 313 | else |
318 | else | 314 | lua_pushfstring(L, " in function <%s:%d>", |
319 | lua_pushfstring(L, " in function <%s:%d>", | 315 | ar.short_src, ar.linedefined); |
320 | ar.short_src, ar.linedefined); | ||
321 | } | ||
322 | } | 316 | } |
323 | lua_concat(L, lua_gettop(L) - arg); | 317 | lua_concat(L, lua_gettop(L) - arg); |
324 | } | 318 | } |