|
165 | 165 | <methods> |
166 | 166 | <method name="all" qualifiers="const"> |
167 | 167 | <return type="bool" /> |
168 | | - <param index="0" name="method" type="Callable" /> |
| 168 | + <param index="0" name="callable" type="Callable" /> |
169 | 169 | <description> |
170 | 170 | Calls the given [Callable] on each element in the array and returns [code]true[/code] if the [Callable] returns [code]true[/code] for [i]all[/i] elements in the array. If the [Callable] returns [code]false[/code] for one array element or more, this method returns [code]false[/code]. |
171 | | - The [param method] should take one [Variant] parameter (the current array element) and return a [bool]. |
| 171 | + The [param callable] should take one [Variant] parameter (the current array element) and return a [bool]. |
172 | 172 | [codeblocks] |
173 | 173 | [gdscript] |
174 | 174 | func greater_than_5(number): |
|
212 | 212 | </method> |
213 | 213 | <method name="any" qualifiers="const"> |
214 | 214 | <return type="bool" /> |
215 | | - <param index="0" name="method" type="Callable" /> |
| 215 | + <param index="0" name="callable" type="Callable" /> |
216 | 216 | <description> |
217 | 217 | Calls the given [Callable] on each element in the array and returns [code]true[/code] if the [Callable] returns [code]true[/code] for [i]one or more[/i] elements in the array. If the [Callable] returns [code]false[/code] for all elements in the array, this method returns [code]false[/code]. |
218 | | - The [param method] should take one [Variant] parameter (the current array element) and return a [bool]. |
| 218 | + The [param callable] should take one [Variant] parameter (the current array element) and return a [bool]. |
219 | 219 | [codeblock] |
220 | 220 | func greater_than_5(number): |
221 | 221 | return number > 5 |
|
386 | 386 | </method> |
387 | 387 | <method name="filter" qualifiers="const"> |
388 | 388 | <return type="Array" /> |
389 | | - <param index="0" name="method" type="Callable" /> |
| 389 | + <param index="0" name="callable" type="Callable" /> |
390 | 390 | <description> |
391 | 391 | Calls the given [Callable] on each element in the array and returns a new, filtered [Array]. |
392 | | - The [param method] receives one of the array elements as an argument, and should return [code]true[/code] to add the element to the filtered array, or [code]false[/code] to exclude it. |
| 392 | + The [param callable] receives one of the array elements as an argument, and should return [code]true[/code] to add the element to the filtered array, or [code]false[/code] to exclude it. |
393 | 393 | [codeblock] |
394 | 394 | func is_even(number): |
395 | 395 | return number % 2 == 0 |
|
415 | 415 | </method> |
416 | 416 | <method name="find_custom" qualifiers="const"> |
417 | 417 | <return type="int" /> |
418 | | - <param index="0" name="method" type="Callable" /> |
| 418 | + <param index="0" name="callable" type="Callable" /> |
419 | 419 | <param index="1" name="from" type="int" default="0" /> |
420 | 420 | <description> |
421 | | - Returns the index of the [b]first[/b] element in the array that causes [param method] to return [code]true[/code], or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the end of the array. |
422 | | - [param method] is a callable that takes an element of the array, and returns a [bool]. |
423 | | - [b]Note:[/b] If you just want to know whether the array contains [i]anything[/i] that satisfies [param method], use [method any]. |
| 421 | + Returns the index of the [b]first[/b] element in the array that causes [param callable] to return [code]true[/code], or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the end of the array. |
| 422 | + [param callable] takes an element of the array and returns a [bool]. |
| 423 | + [b]Note:[/b] If you just want to know whether the array contains [i]anything[/i] that satisfies [param callable], use [method any]. |
424 | 424 | [codeblocks] |
425 | 425 | [gdscript] |
426 | 426 | func is_even(number): |
|
551 | 551 | </method> |
552 | 552 | <method name="map" qualifiers="const"> |
553 | 553 | <return type="Array" /> |
554 | | - <param index="0" name="method" type="Callable" /> |
| 554 | + <param index="0" name="callable" type="Callable" /> |
555 | 555 | <description> |
556 | | - Calls the given [Callable] for each element in the array and returns a new array filled with values returned by the [param method]. |
557 | | - The [param method] should take one [Variant] parameter (the current array element) and can return any [Variant]. |
| 556 | + Calls the given [Callable] for each element in the array and returns a new array filled with values returned by the [param callable]. |
| 557 | + The [param callable] should take one [Variant] parameter (the current array element) and can return any [Variant]. |
558 | 558 | [codeblock] |
559 | 559 | func double(number): |
560 | 560 | return number * 2 |
|
636 | 636 | </method> |
637 | 637 | <method name="reduce" qualifiers="const"> |
638 | 638 | <return type="Variant" /> |
639 | | - <param index="0" name="method" type="Callable" /> |
| 639 | + <param index="0" name="callable" type="Callable" /> |
640 | 640 | <param index="1" name="accum" type="Variant" default="null" /> |
641 | 641 | <description> |
642 | 642 | Calls the given [Callable] for each element in array, accumulates the result in [param accum], then returns it. |
643 | | - The [param method] takes two arguments: the current value of [param accum] and the current array element. If [param accum] is [code]null[/code] (as by default), the iteration will start from the second element, with the first one used as initial value of [param accum]. |
| 643 | + The [param callable] takes two arguments: the current value of [param accum] and the current array element. If [param accum] is [code]null[/code] (as by default), the iteration will start from the second element, with the first one used as initial value of [param accum]. |
644 | 644 | [codeblock] |
645 | 645 | func sum(accum, number): |
646 | 646 | return accum + number |
|
711 | 711 | </method> |
712 | 712 | <method name="rfind_custom" qualifiers="const"> |
713 | 713 | <return type="int" /> |
714 | | - <param index="0" name="method" type="Callable" /> |
| 714 | + <param index="0" name="callable" type="Callable" /> |
715 | 715 | <param index="1" name="from" type="int" default="-1" /> |
716 | 716 | <description> |
717 | | - Returns the index of the [b]last[/b] element of the array that causes [param method] to return [code]true[/code], or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the beginning of the array. This method is the reverse of [method find_custom]. |
| 717 | + Returns the index of the [b]last[/b] element of the array that causes [param callable] to return [code]true[/code], or [code]-1[/code] if there are none. The search's start can be specified with [param from], continuing to the beginning of the array. This method is the reverse of [method find_custom]. |
718 | 718 | </description> |
719 | 719 | </method> |
720 | 720 | <method name="set"> |
|
0 commit comments