Returns information about the current function call stack


See also Debugging and Profiling functions.

Signature:

debugstring = debugstack(start, countTop, countBot)

Arguments:

  • start - Stack level at which to begin listing functions; 0 is the debugstack() function itself, 1 is the function that called debugstack(), 2 is the function that called function 1, etc. Defaults to 1 if omitted (number)
  • countTop - Maximum number of functions to output at the top of the stack trace (number)
  • countBot - Maximum number of functions to output at the bottom of the stack trace, (number)

Returns:

  • debugstring - A multi-line string describing the current function call stack (string)

Examples:

print(debugstack())
-- output:
[string "print(debugstack())"]:1: in main chunk
  [C]: in function `RunScript'
  Interface\FrameXML\ChatFrame.lua:1826: in function `?'
  Interface\FrameXML\ChatFrame.lua:3332: in function `ChatEdit_ParseText'
  Interface\FrameXML\ChatFrame.lua:3052: in function `ChatEdit_SendText'
  Interface\FrameXML\ChatFrame.lua:3073: in function 
  [C]: in function `ChatEdit_OnEnterPressed'
  [string "*:OnEnterPressed"]:1: in function <[string "*:OnEnterPressed"]:1>