More tweaks on tracebacks

This commit is contained in:
2026-05-21 19:40:30 -04:00
parent 521d4726ad
commit 933c1ac6c3
2 changed files with 12 additions and 3 deletions

View File

@@ -50,9 +50,16 @@ int traceback_coroutine(lua_State *L) {
if ((ar.currentline > 0) || (*ar.namewhat != 0) || (*ar.what != 'C')) {
any = true;
lua_pushliteral(L, "\n\t");
lua_pushfstring(L, "%s", ar.short_src);
if (ar.currentline > 0 && strcmp(ar.short_src, "<console>"))
lua_pushfstring(L, " line %d", ar.currentline);
if (strcmp(ar.short_src, "<console>")==0)
{
lua_pushstring(L, "in the console");
}
else
{
lua_pushfstring(L, "in %s", ar.short_src);
if (ar.currentline > 0)
lua_pushfstring(L, " line %d", ar.currentline);
}
if (*ar.namewhat != '\0') /* is there a name? */
lua_pushfstring(L, " in function " LUA_QS, ar.name);
else {