template-live-editor/0007-save_callstack

8 lines
453 B
Plaintext

-- Internal helper for animate()
-- Records the stack of function calls that led to any error within a debug animation coroutine.
-- Lua normally prints out errors with callstacks, but coroutines interrupt the stack unless we do some additional work.
save_callstack = function(err)
local callstack = debug.traceback('', --[[stack frame]]2)
Error_with_callstack = 'Error: ' .. cleaned_up_frame(tostring(err))..'\n'..cleaned_up_callstack(callstack)
end