From ed5bc5ebc7c25cb942c90d14f15597a595267044 Mon Sep 17 00:00:00 2001 From: Danil Alexeev Date: Thu, 27 Nov 2025 16:33:55 +0300 Subject: [PATCH] GDScript: Clarify the use of `callv()` to call variadic functions --- tutorials/scripting/gdscript/gdscript_basics.rst | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tutorials/scripting/gdscript/gdscript_basics.rst b/tutorials/scripting/gdscript/gdscript_basics.rst index b3c0e73076b..4149573f3aa 100644 --- a/tutorials/scripting/gdscript/gdscript_basics.rst +++ b/tutorials/scripting/gdscript/gdscript_basics.rst @@ -1651,13 +1651,20 @@ as a static type of the rest parameter: :: - func log_data(...values): - # ... - - func other_func(...args): + func test_func(...args): #log_data(...args) # This won't work. log_data.callv(args) # This will work. + func log_data(...values): + # You should use `callv()` if you want to pass `values` as the argument list, + # rather than passing the array as the first argument. + prints.callv(values) + # You can use array concatenation to prepend/append the argument list. + write_data.callv(["user://log.txt"] + values) + + func write_data(path, ...values): + # ... + Abstract functions ~~~~~~~~~~~~~~~~~~