/callstack-legacy

v1 version of callstack

Primary LanguageAutoHotkeyGNU General Public License v3.0GPL-3.0

callstack() (legacy)

v1 version of callstack.

I encourage you to not use this function if you can use the v2 version.

Definition

stack := callstack(limit := -1)
  • limitinteger: The amount of callstack entries to return.
    • If limit is positive or 0, stack.length() equals limit.
  • stackarray of objects: The current callstack (including the call to callstack() itself).
    • Each entry represents one entry in the callstack.
    • Each entry is an object. Each object has three keys:
      • filestring: The full path of the file the entry of the callstack points to.
      • lineinteger: The line number of the line the entry of the callstack points to.
      • funcstring: The name of the function the entry of the callstack points to.

Example

test1() {
  test2()
}
test2() {
  test3()
}
test3() {
  callstack()
}

strStack := ""
for _, entry in test1() {
  strStack .= "Line: " entry["line"] "`nFile: " entry["file"] "`nFunc: " entry["func"] "`n----`n"
}
msgbox, % strStack