System.CallDepth - Manhunter07/MFL GitHub Wiki

Declaration

function CallDepth: System.PosInt = \built-in\

Description

The CallDepth function in the System package returns the current outside-itself function call depth at the moment of evaluation. It is 0 if called from outside a function and 1 or greater if called from inside. Each object from the call stack is added into the returned number with the exception of the CallDepth function itself which is left out.

Remarks

  • The result of this function is identical to the expression Length(CallStack)
  • CallDepth does not count the call to itself for its result value
  • You may use the Caller function helper to get the caller function (or Nil) of the current function

See also