debug.caller(nil) -> function or nil return current function
debug.caller(int) -> function or nil return the nth caller in chain (default is 1).
One typical use-case is to get the name of the current function, or the name of the caller function. Note: use introspect.name() to get the name of a function.
Example:
def guess_my_name()
import debug
import introspect
var func = debug.caller()
var func_name = introspect.name(func)
print(func_name)
end
guess_my_name()
# prints: guess_my_name
Add
debug.caller()
with the following semantics:debug.caller(nil) -> function or nil
return current functiondebug.caller(int) -> function or nil
return the nth caller in chain (default is1
).One typical use-case is to get the name of the current function, or the name of the caller function. Note: use
introspect.name()
to get the name of a function.Example: