Quirrel4.53.0

function

Methods on every closure.

Functions

acallfunction.acall(args: array): anyCalls the closure with the arguments taken from an array: args[0] becomes this, and the rest of args becomes the closure's own parameters.
bindenvnodiscard function.bindenv(env: table|instance|class): anyReturns a copy of the closure with env statically bound as its this: every future call to the copy uses env, no matter how it is called.
callfunction.call(...): anyCalls the closure, using env as its this and forwarding the rest of the arguments as its own parameters.
clonenodiscard clone(): anyReturns the closure itself: unlike a table, array or class instance, a closure has no separate clone identity.
getaritynodiscard function.getarity(): anyReturns how many arguments the closure takes: the counts that getfuncinfos gives, without the names, defaults and type masks it collects.
getfreevarnodiscard function.getfreevar(index: int): anyReturns the name and current value of one of the closure's free variables (the outer locals it captured when it was created).
getfuncinfosnodiscard function.getfuncinfos(): anyReturns a table describing the closure: its name, parameters, and other introspection data the VM tracks for it.
pacallfunction.pacall(args: array): anyCalls the closure like acall does, taking this and the arguments from an array: args[0] becomes this, and the rest of args becomes the closure's own parameters.
pcallfunction.pcall(...): anyCalls the closure like call does, using env as its this and forwarding the rest of the arguments as its own parameters.
tostringnodiscard tostring(): anyReturns a string that names the type and identity of the closure.
weakrefnodiscard weakref(): anyReturns a weak reference to the closure.