Sorry, I was mistakenly attributing error() problems to traceback().
traceback() does start the traceback at level, while error() does not (level affects the location prepended to the string message only).
I think this issue with error() has been raised in the past, nothing new.
actual code this time:
function foo()
print(debug.traceback('hi from traceback', 2)) -- level 2, hide foo()
error('hi from error', 2)
end
function bar()
foo()
end
bar()
-->
$ lua traceback.lua
hi from traceback
stack traceback:
traceback.lua:8: in function 'bar'
traceback.lua:11: in main chunk
[C]: in ?
lua: traceback.lua:8: hi from error
stack traceback:
[C]: in function 'error'
traceback.lua:4: in function 'foo'
traceback.lua:8: in function 'bar'
traceback.lua:11: in main chunk
[C]: in ?