Hi Matthew,
Thanks and WOW!!!
I like the format of the traceback from Prosody much more than the
default format in Lua! I didn't learn how to run the tests that you
suggested, but I adapted the middle part of the _traceback() function
in debug.lua(), and got this:
-- Adapted from (the middle part of) the traceback function
-- of Prosody. See the message by Matthew Wild in 2022mar22
-- in <
http://lua-users.org/lists/lua-l/2022-03/>.
prosodytraceback = function (info)
local line
local func_type = info.namewhat.." "
local source_desc = (info.short_src == "[C]" and "C code")
or info.short_src or "Unknown"
if func_type == " " then func_type = "" end
if info.short_src == "[C]" then
line = "[ C ] "..func_type.."C function "
..(
info.name and ("%q"):format(
info.name) or "(unknown name)")
elseif info.what == "main" then
line = "[Lua] "..info.short_src.." line "..info.currentline
else
local name =
info.name or " "
if name ~= " "
then name = ("%q"):format(name)
end
if func_type == "global " or func_type == "local "
then func_type = func_type.."function "
end
line = "[Lua] "..info.short_src.." line "..
info.currentline.." in "..func_type..name..
" (defined on line "..info.linedefined..")"
end
return line
end
Thanks again =),
Eduardo Ochs
http://angg.twu.net/#eev