Function.arguments.caller

Specifies the name of the function that invoked the currently executing function.

Property of Function.arguments

Description

caller is no longer used.

The caller property is available only within the body of a function.

If the currently executing function was invoked by the top level of a MetaScript program, the value of caller is null.

The this keyword does not refer to the currently executing function, so you must refer to functions and Function objects by name, even within the function body.

The caller property is a reference to the calling function, so
If you use it in a string context, you get the result of calling functionName.toString. That is, the decompiled canonical source form of the function.
You can also call the calling function, if you know what arguments it might want. Thus, a called function can call its caller without knowing the name of the particular caller, provided it knows that all of its callers have the same form and fit, and that they will not call the called function again unconditionally (which would result in infinite recursion).

Examples

The following code checks the value of a function's caller property.

See also

Function.arguments

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.