godotengine / godotengine/godot-docs
Mention `var x = await signal` retrieves parameters passed to signal
- Dominant language
- reStructuredText
- Stars
- 5.7k
- Forks
- 3.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 25
Description
**Your Godot version:**
4.1.3
**Issue description:**
I recently learned that by doing `var x = await signal_name`, where `signal_name` is a signal instead of a function, x will be assigned the parameters passed to the signal (x will be array when there are multiple parameters). This behavior is immensely helpful for my project and enables a lot of interesting code patterns.
Unfortunately, I cannot find this behavior documented anywhere. I believe this should be documented on the GDScript page, in the section dedicated to await. The page currently only mentions await assigning function return values, but not the parameters of signals. For a long time this made me believe that awaiting signals with assignment is not possible.
**URL to the documentation page:**
https://docs.godotengine.org/en/stable/tutorials/scripting/gdscript/gdscript_basics.html#awaiting-for-signals-or-coroutines
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.