Created
March 17, 2026 16:43
-
-
Save jspahrsummers/287534d3f9bf77a96ec3fff251ba0569 to your computer and use it in GitHub Desktop.
await_any() for Godot 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _Awaiter: | |
| signal any_finished | |
| func call_async(callable: Callable) -> void: | |
| await callable.call() | |
| any_finished.emit() | |
| static func await_any(callables: Array[Callable]) -> void: | |
| var awaiter := _Awaiter.new() | |
| for callable in callables: | |
| awaiter.call_async(callable) | |
| await awaiter.any_finished |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment