So I can create a Callable with a lambda, which I can then pass to Signal.connect. Is this a bad idea?
The docs show create_tween().tween_callback(func(): my_dictionary.clear())
which is a similar concept though not the same mechanism. With a signal that would be some_signal.connect(func(): my_dictionary.clear())
. I worry if this would be a bad practice. I don't know how to or if I can remove a Callable without a name from a Signal, and later on what happens if the Signal emits but my Object which provided the lambda is gone?
Maybe if I bind a Callable to itself and have it disconnect itself? Would that work? Something like
var button:Button = $"Button"
var callable := func (p_this:Callable, p_button:Button):
if p_button.pressed.is_connected(p_this):
p_button.pressed.disconnect(p_this)
callable.bindv([callable, button])
button.pressed.connect(callable)
I'm gonna test this but please stop me if this is a terrible idea.