diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-11-12 12:13:04 -0600 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-11-12 12:13:04 -0600 |
commit | cc6ee3e956309de046dc1ed09b2f38a5ec7a76c7 (patch) | |
tree | 8fac3221341ccada8ebef5afdf608b2b85f33ee9 /doc/classes | |
parent | 75dc6e19cdfcc1d32b40cefbd1b36360fcafe493 (diff) | |
parent | e379cc76e5e4cdba8393ed5988f12a6c46a77493 (diff) | |
download | redot-engine-cc6ee3e956309de046dc1ed09b2f38a5ec7a76c7.tar.gz |
Merge pull request #98713 from dalexeev/core-fix-callable-get-bound-arguments
Core: Fix `Callable.get_bound_arguments{,_count}()` return incorrect data
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/Callable.xml | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/doc/classes/Callable.xml b/doc/classes/Callable.xml index 0c8f3c66f5..cf3c3e06fd 100644 --- a/doc/classes/Callable.xml +++ b/doc/classes/Callable.xml @@ -155,13 +155,21 @@ <method name="get_bound_arguments" qualifiers="const"> <return type="Array" /> <description> - Return the bound arguments (as long as [method get_bound_arguments_count] is greater than zero), or empty (if [method get_bound_arguments_count] is less than or equal to zero). + Returns the array of arguments bound via successive [method bind] or [method unbind] calls. These arguments will be added [i]after[/i] the arguments passed to the call, from which [method get_unbound_arguments_count] arguments on the right have been previously excluded. + [codeblock] + func get_effective_arguments(callable, call_args): + assert(call_args.size() - callable.get_unbound_arguments_count() >= 0) + var result = call_args.slice(0, call_args.size() - callable.get_unbound_arguments_count()) + result.append_array(callable.get_bound_arguments()) + return result + [/codeblock] </description> </method> <method name="get_bound_arguments_count" qualifiers="const"> <return type="int" /> <description> - Returns the total amount of arguments bound (or unbound) via successive [method bind] or [method unbind] calls. If the amount of arguments unbound is greater than the ones bound, this function returns a value less than zero. + Returns the total amount of arguments bound via successive [method bind] or [method unbind] calls. This is the same as the size of the array returned by [method get_bound_arguments]. See [method get_bound_arguments] for details. + [b]Note:[/b] The [method get_bound_arguments_count] and [method get_unbound_arguments_count] methods can both return positive values. </description> </method> <method name="get_method" qualifiers="const"> @@ -182,6 +190,13 @@ Returns the ID of this [Callable]'s object (see [method Object.get_instance_id]). </description> </method> + <method name="get_unbound_arguments_count" qualifiers="const"> + <return type="int" /> + <description> + Returns the total amount of arguments unbound via successive [method bind] or [method unbind] calls. See [method get_bound_arguments] for details. + [b]Note:[/b] The [method get_bound_arguments_count] and [method get_unbound_arguments_count] methods can both return positive values. + </description> + </method> <method name="hash" qualifiers="const"> <return type="int" /> <description> |