Quirrel4.41.0

types.Function.getfuncinfos

Method on every function
function.getfuncinfos(): any

Returns a table describing the closure: its name, parameters, and other introspection data the VM tracks for it.

Return value

A table with these keys:

Notes

this is always parameters[0], so required_params and the length of parameters both count it; debug.get_function_info_table's requiredArgs and argNames do not, so f.getfuncinfos().required_params is one higher than get_function_info_table(f).requiredArgs for the same f.

Example

examples/types/function/getfuncinfos.nut
function add(a, b = 10) { return a + b }
let info = add.getfuncinfos()
println($"{info.name} required_params={info.required_params}")
println($"parameters={", ".join(info.parameters)}")
println($"varargs={info.varargs} native={info.native}")
Output:
add required_params=2
parameters=this, a, b
varargs=false native=false

See also

get_function_info_tableReturns meta information about a function as table
getfreevarReturns the name and current value of one of the closure's free variables (the outer locals it captured when it was created).
functionclass index