FuncRef

Reference to a function in an object.

In GDScript, functions are not first-class objects. This means it is impossible to store them directly as variables, return them from another function, or pass them as arguments. However, by creating a FuncRef using the @GDScript.funcref function, a reference to a function in a given object can be created, passed around and called.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

callFunc
Variant callFunc(VarArgs varArgs)

Calls the referenced function previously set in _function or @GDScript.funcref.

callFuncv
Variant callFuncv(Array arg_array)

Calls the referenced function previously set in _function or @GDScript.funcref. Contrarily to callFunc, this method does not support a variable number of arguments but expects all parameters to be passed via a single Array.

getFunction
String getFunction()
isValid
bool isValid()

Returns whether the object still exists and has the function assigned.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(FuncRef other)
opEquals
bool opEquals(typeof(null) n)
setFunction
void setFunction(String name)
setInstance
void setInstance(GodotObject instance)

The object containing the referenced function. This object must be of a type actually inheriting from GodotObject, not a built-in type such as long, Vector2 or Dictionary.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

_function
String _function [@property getter]
String _function [@property setter]

The name of the referenced function.

Static functions

_new
FuncRef _new()

Construct a new instance of FuncRef. Note: use memnew!FuncRef instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta