From e4cbd48ded6533ffc6c2f4b752206da066b959e6 Mon Sep 17 00:00:00 2001 From: Muller-Castro <37383316+Muller-Castro@users.noreply.github.com> Date: Fri, 24 Oct 2025 00:02:05 -0300 Subject: [PATCH] Add await signal args example --- .../scripting/gdscript/gdscript_basics.rst | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tutorials/scripting/gdscript/gdscript_basics.rst b/tutorials/scripting/gdscript/gdscript_basics.rst index 0a8e26b0619..9a5657950d3 100644 --- a/tutorials/scripting/gdscript/gdscript_basics.rst +++ b/tutorials/scripting/gdscript/gdscript_basics.rst @@ -2866,6 +2866,30 @@ This also means that returning a signal from a function that isn't a coroutine w With this type safety in place, a function cannot say that it returns an ``int`` while it actually returns a function state object during runtime. +You can store the arguments passed to the signal's parameters. If there is only one parameter, the awaited value will have the same type as the argument: + +:: + + func toggled(): + var signal_args = await $Button.toggled + assert(typeof(signal_args) == TYPE_BOOL) + +If there is more than one parameter, the awaited value will be of type ``Array``: + +:: + + func request_completed(): + var signal_args = await $HTTPRequest.request_completed + assert(typeof(signal_args) == TYPE_ARRAY) + +Otherwise, the awaited value will be ``null``: + +:: + + func button_up(): + var signal_args = await $Button.button_up + assert(signal_args == null) + Assert keyword --------------