Skip to content

Commit 4421c62

Browse files
committed
Update binding Signal connection args docs
1 parent fd34a00 commit 4421c62

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tutorials/scripting/gdscript/gdscript_basics.rst

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2439,20 +2439,19 @@ arguments when you emit signals; it's up to you to emit the correct values.
24392439

24402440
.. image:: img/gdscript_basics_signals_node_tab_1.png
24412441

2442-
GDScript can bind an array of values to connections between a signal
2443-
and a method. When the signal is emitted, the callback method receives
2444-
the bound values. These bound arguments are unique to each connection,
2445-
and the values will stay the same.
2442+
You can also create copies of GDScript Callable objects which accept additional
2443+
arguments using :ref:`Callable.bind() <class_Callable_method_bind>`. This
2444+
allows you to add extra information to the connection if the emitted signal
2445+
itself doesn't give you access to all the data that you need.
24462446

2447-
You can use this array of values to add extra constant information to the
2448-
connection if the emitted signal itself doesn't give you access to all the data
2449-
that you need.
2447+
When the signal is emitted, the callback method receives the bound values, in
2448+
addition to those provided by the signal.
24502449

24512450
Building on the example above, let's say we want to display a log of the damage
24522451
taken by each character on the screen, like ``Player1 took 22 damage.``. The
24532452
``health_changed`` signal doesn't give us the name of the character that took
24542453
damage. So when we connect the signal to the in-game console, we can add the
2455-
character's name in the binds array argument::
2454+
character's name using the bind method::
24562455

24572456
# game.gd
24582457

@@ -2462,7 +2461,7 @@ character's name in the binds array argument::
24622461

24632462
character_node.health_changed.connect(battle_log_node._on_Character_health_changed.bind(character_node.name))
24642463

2465-
Our ``BattleLog`` node receives each element in the binds array as an extra argument::
2464+
Our ``BattleLog`` node receives each bound element as an extra argument::
24662465

24672466
# battle_log.gd
24682467

0 commit comments

Comments
 (0)