summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-07 13:18:16 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-07 13:18:16 +0100
commit0ab91b3d7939a3dc92314f4b86cf0a609756dd40 (patch)
treebd1dc040a79866f57c899a7c1c186e3cf82ec5a5 /doc/classes
parent57540ae00d7a232f89e691f8163b8d3cfa8da0e0 (diff)
parent1f6a5e8bb123a3620161ee194175aef571147c30 (diff)
Merge pull request #70993 from rcorre/array-erase-doc
Warn against erasing array elements while iterating.
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/Array.xml2
1 files changed, 2 insertions, 0 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 603974d619..ee21493434 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -40,6 +40,7 @@
[/codeblocks]
[b]Note:[/b] Concatenating with the [code]+=[/code] operator will create a new array, which has a cost. If you want to append another array to an existing array, [method append_array] is more efficient.
[b]Note:[/b] Arrays are always passed by reference. To get a copy of an array that can be modified independently of the original array, use [method duplicate].
+ [b]Note:[/b] Erasing elements while iterating over arrays is [b]not[/b] supported and will result in unpredictable behavior.
[b]Note:[/b] When declaring an array with [code]const[/code], the array itself can still be mutated by defining the values at individual indices or pushing/removing elements. Using [code]const[/code] will only prevent assigning the constant with another value after it was initialized.
</description>
<tutorials>
@@ -253,6 +254,7 @@
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] 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.
</description>
</method>
<method name="fill">