During testing of the early version of our new Lua VM, we found a few games that relied on the precise format returned by debug.traceback
function. This is a PSA asking to change code that relies on that - be aware that we reserve the right to change the format without notice.
The changes have to do in part with the cleanup of the resulting format that make it match stock Lua better, and in part due to fundamental differences in how new VM works and what it can support.
Here’s an example of debug.traceback
output for a semi-complex example:
function foo()
print(debug.traceback())
end
local function bar()
foo()
end
local Moo = {}
Moo.baz = function()
bar()
end
function Moo:test()
self:baz()
end
Moo:test()
Lua 5.1 prints this:
stack traceback:
test.lua:2: in function 'foo'
test.lua:6: in function 'bar'
test.lua:11: in function 'baz'
test.lua:15: in function 'test'
test.lua:18: in main chunk
Roblox Lua prints this today:
Stack Begin
Script 'Workspace.Script', Line 2 - global foo
Script 'Workspace.Script', Line 6 - upvalue bar
Script 'Workspace.Script', Line 11 - method baz
Script 'Workspace.Script', Line 15 - method test
Script 'Workspace.Script', Line 18
Stack End
Our work in progress VM currently prints this (this may change!):
Workspace.Script:2 function foo
Workspace.Script:7 function bar
Workspace.Script:12
Workspace.Script:16 function test
Workspace.Script:18
… you get the idea. We have found games that looked at the output of debug.traceback
and, for example, expected it to always start with “Stack Begin”, or to have methods annotated with “method” instead of a generic “function”. If you have code that does this today, please change it - debug.traceback should be used for debug diagnostics and error analytics exclusively.
We are updating DevHub documentation that, unfortunately, treated the output format as a contract, to note that the format isn’t stable as well.