Is there a call_deferred() for Callable?

Godot Version

v4.3.stable.official [77dcf97d8]

Question

Is there any equivalent of call_deferred() that takes a closure as a parameter?

Callable.call_deferred()

func _ready() -> void:
	var callable = func(): print("second")
	print("first")
	callable.call_deferred()
	print("third")

Will print:

first
third
second

You can do the same with all other functions like:

func _ready() -> void:
	print("first")
	print.call_deferred("second")
	print("third")

Will print the same as the example above.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.