[3.x] Bind Array and Pool*Array get and set functions

This commit is contained in:
Aaron Franke
2024-08-26 14:46:47 -07:00
parent 01c78d87fe
commit 699a48d8f1
12 changed files with 86 additions and 0 deletions

View File

@@ -211,6 +211,13 @@
[b]Note:[/b] Calling this function is not the same as writing [code]array[0][/code]. If the array is empty, accessing by index will pause project execution when running from the editor.
</description>
</method>
<method name="get">
<return type="Variant" />
<argument index="0" name="index" type="int" />
<description>
Returns the element at the given [code]index[/code] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
</description>
</method>
<method name="has">
<return type="bool" />
<argument index="0" name="value" type="Variant" />
@@ -329,6 +336,13 @@
Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array. If the adjusted start index is out of bounds, this method searches from the end of the array.
</description>
</method>
<method name="set">
<argument index="0" name="index" type="int" />
<argument index="1" name="value" type="Variant" />
<description>
Sets the value of the element at the given [code]index[/code] to the given [code]value[/code]. This will not change the size of the array, it only changes the value at an index already in the array. This is the same as using the [code][][/code] operator ([code]array[index] = value[/code]).
</description>
</method>
<method name="shuffle">
<description>
Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as [method @GDScript.randi]. Call [method @GDScript.randomize] to ensure that a new seed will be used each time if you want non-reproducible shuffling.