Clarify Array class methods that return error

related to #47406
This commit is contained in:
curious-broccoli 2023-08-23 18:26:45 +02:00
parent 75f9c97dea
commit d8e7ce58ee
1 changed files with 6 additions and 5 deletions

View File

@ -257,7 +257,7 @@
<param index="0" name="value" type="Variant" /> <param index="0" name="value" type="Variant" />
<description> <description>
Removes the first occurrence of a value from the array. If the value does not exist in the array, nothing happens. To remove an element by index, use [method remove_at] instead. Removes the first occurrence of a value from the array. If the value does not exist in the array, nothing happens. To remove an element by index, use [method remove_at] instead.
[b]Note:[/b] This method acts in-place and doesn't return a value. [b]Note:[/b] This method acts in-place and doesn't return a modified array.
[b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed. [b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed.
[b]Note:[/b] Do not erase entries while iterating over the array. [b]Note:[/b] Do not erase entries while iterating over the array.
</description> </description>
@ -383,8 +383,8 @@
<param index="0" name="position" type="int" /> <param index="0" name="position" type="int" />
<param index="1" name="value" type="Variant" /> <param index="1" name="value" type="Variant" />
<description> <description>
Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]pos == size()[/code]). Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]pos == size()[/code]). Returns [constant OK] on success, or one of the other [enum Error] values if the operation failed.
[b]Note:[/b] This method acts in-place and doesn't return a value. [b]Note:[/b] This method acts in-place and doesn't return a modified array.
[b]Note:[/b] On large arrays, this method will be slower if the inserted element is close to the beginning of the array (index 0). This is because all elements placed after the newly inserted element have to be reindexed. [b]Note:[/b] On large arrays, this method will be slower if the inserted element is close to the beginning of the array (index 0). This is because all elements placed after the newly inserted element have to be reindexed.
</description> </description>
</method> </method>
@ -534,7 +534,7 @@
<param index="0" name="position" type="int" /> <param index="0" name="position" type="int" />
<description> <description>
Removes an element from the array by index. If the index does not exist in the array, nothing happens. To remove an element by searching for its value, use [method erase] instead. Removes an element from the array by index. If the index does not exist in the array, nothing happens. To remove an element by searching for its value, use [method erase] instead.
[b]Note:[/b] This method acts in-place and doesn't return a value. [b]Note:[/b] This method acts in-place and doesn't return a modified array.
[b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed. [b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed.
[b]Note:[/b] [param position] cannot be negative. To remove an element relative to the end of the array, use [code]arr.remove_at(arr.size() - (i + 1))[/code]. To remove the last element from the array without returning the value, use [code]arr.resize(arr.size() - 1)[/code]. [b]Note:[/b] [param position] cannot be negative. To remove an element relative to the end of the array, use [code]arr.remove_at(arr.size() - (i + 1))[/code]. To remove the last element from the array without returning the value, use [code]arr.resize(arr.size() - 1)[/code].
</description> </description>
@ -543,7 +543,8 @@
<return type="int" /> <return type="int" />
<param index="0" name="size" type="int" /> <param index="0" name="size" type="int" />
<description> <description>
Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are [code]null[/code]. Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are [code]null[/code]. Returns [constant OK] on success, or one of the other [enum Error] values if the operation failed.
[b]Note:[/b] This method acts in-place and doesn't return a modified array.
</description> </description>
</method> </method>
<method name="reverse"> <method name="reverse">