Clarify Array.erase for nonexistant element.

The docs specify that Array.remove does nothing if the index does not
exist. Array.erase does not have a similar phrase, so it's unclear if
erase will print an error, or silently do nothing.

(cherry picked from commit f84e2db35e2f6eceb4f8c3a1e8e9de7adf6f4c30)
This commit is contained in:
Ryan Roden-Corrent 2022-04-05 07:07:56 -04:00 committed by Relintai
parent 2aefcf5585
commit 794c54a386

View File

@ -184,7 +184,7 @@
<method name="erase"> <method name="erase">
<argument index="0" name="value" type="Variant" /> <argument index="0" name="value" type="Variant" />
<description> <description>
Removes the first occurrence of a value from the array. To remove an element by index, use [method remove] 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] 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 value.
[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.
</description> </description>