From d8e7ce58eeefaf09b85ea40f8357fb4cd5b236b9 Mon Sep 17 00:00:00 2001
From: curious-broccoli <77789413+curious-broccoli@users.noreply.github.com>
Date: Wed, 23 Aug 2023 18:26:45 +0200
Subject: [PATCH] Clarify Array class methods that return error
related to #47406
---
doc/classes/Array.xml | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml
index 999cc6fa2993..cc7095f9639d 100644
--- a/doc/classes/Array.xml
+++ b/doc/classes/Array.xml
@@ -257,7 +257,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] 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] Do not erase entries while iterating over the array.
@@ -383,8 +383,8 @@
- 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]).
- [b]Note:[/b] This method acts in-place and doesn't return a value.
+ 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 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.
@@ -534,7 +534,7 @@
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] [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].
@@ -543,7 +543,8 @@
- 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.