Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | trafel | |
Old Version | Published before Godot 3 was released. |
I was just wondering if this was possible :
func c_function(value, callback):
#Do stuff ...
callback(value)
#Do stuff ...
Or just a basic function passing as an argument.
Contrary to Python, functions are not first-class objects in GDScript.
This means they cannot be stored in variables, passed as an argument
to another function or be returned from other functions. This is for
performance reasons.To reference a function by name at run-time, (e.g. to store it in a
variable, or pass it to another function as an argument) one must use
the call or funcref helpers
GDScript reference — Godot Engine (stable) documentation in English
snesgx | 2020-11-20 16:27