Quirrel4.41.0

types.Table.getfuncinfos

Method on every table
table.getfuncinfos(): any

If the table has a delegate providing a _call metamethod, returns introspection info about that metamethod's closure; otherwise returns null.

examples/types/table/getfuncinfos-basic.nut
let squad = {healer = 1}
println("squad.getfuncinfos() =", squad.getfuncinfos())
Output:
squad.getfuncinfos() = null

Return value

null, or a table with fields such as name, parameters, required_params and varargs describing the _call closure - the same shape a closure's own getfuncinfos() returns.

Notes

Takes no arguments. This almost always returns null for a table built purely in script: a table's delegate can only be attached with sq_setdelegate, a C API call. Quirrel removed the script-level setdelegate()/getdelegate() that Squirrel had, so script code has no way to give a table a _call metamethod, or any other metamethod, of its own.

A slot literally named _call on the table itself does nothing here: this method only looks at the delegate, never at the table's own slots.

Example

examples/types/table/getfuncinfos.nut
let t = {a=1}
// a plain slot named "_call" is not a metamethod: getfuncinfos only looks
// at the table's delegate, and script code has no way to attach one
t._call <- function(self, x) { return x }
println("t.getfuncinfos() =", t.getfuncinfos())
Output:
t.getfuncinfos() = null

See also

hasindexReports whether key is a slot in the table.
tostringReturns a string that names the type and identity of the table.
tableclass index