|Topic was automatically imported from the old Question2Answer platform.
|Published before Godot 3 was released.
How I can create a callback mechanism or signal in class. Let’s say I have created a class and I want to be able to execute a callback when some internal events happen.
I am wondering if something like that would be implemented for class. I suppose not as it is not a Node but only class:
The callback that I wrote is also not ideal solution. For example:
var my_callbacks = 
// check if not already added
// some interal calculations
for fun in my_callbacks:
But that will not work because my_callbacks are just strings so the call function do not know which node/object is the owner. It will simply try to run that name (fun) as the function.