Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
FuncRef¶
Referencia a una función en un objeto.
Descripción¶
En GDScript, las funciones no son objetos de primera clase. Esto significa que es imposible almacenarlas directamente como variables, devolverlas desde otra función, o pasarlas como argumentos.
Sin embargo, al crear una FuncRef
usando la función @GDScript.funcref, se puede crear, pasar y llamar una referencia a una función en un objeto dado.
Propiedades¶
|
Métodos¶
call_func ( ... ) vararg |
|
call_funcv ( Array arg_array ) |
|
is_valid ( ) const |
|
void |
set_instance ( Object instance ) |
Descripciones de Propiedades¶
String function
Default |
|
Setter |
set_function(value) |
Getter |
get_function() |
The name of the referenced function.
Descripciones de Métodos¶
Variant call_func ( ... ) vararg
Calls the referenced function previously set in function or @GDScript.funcref.
Calls the referenced function previously set in function or @GDScript.funcref. Contrarily to call_func, this method does not support a variable number of arguments but expects all parameters to be passed via a single Array.
bool is_valid ( ) const
Devuelve si el objeto todavía existe y tiene la función asignada.
void set_instance ( Object instance )
El objeto que contiene la función referida. Este objeto debe ser de un tipo realmente heredado de Object, no de un tipo interno como int, Vector2 o Dictionary.