Add level argument to debug.traceback

From the Lua 5.1 Reference Manual:

debug.traceback ([thread,] [message [, level]])
Returns a string with a traceback of the call stack. An optional message string is appended at the beginning of the traceback. An optional level number tells at which level to start the traceback (default is 1, the function calling traceback).

Use case

I want to include stack traces with warn or print, but tracing all the way down to the debug.traceback call adds unnecessary noise.

4 Likes