Improve documentation related to Array error handling

This closes https://github.com/godotengine/godot-docs/issues/3834.
This commit is contained in:
Hugo Locurcio 2020-09-06 15:20:42 +02:00
parent 4d34677623
commit 263f620421
No known key found for this signature in database
GPG Key ID: 39E8F8BE30B0A49C
1 changed files with 7 additions and 5 deletions

View File

@ -119,7 +119,8 @@
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Returns the last element of the array. Throws an error and returns [code]null[/code] if the array is empty. Returns the last element of the array. Prints an error and returns [code]null[/code] if the array is empty.
[b]Note:[/b] Calling this function is not the same as writing [code]array[-1][/code]. If the array is empty, accessing by index will pause project execution when running from the editor.
</description> </description>
</method> </method>
<method name="bsearch"> <method name="bsearch">
@ -216,7 +217,8 @@
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Returns the first element of the array. Throws an error and returns [code]null[/code] if the array is empty. Returns the first element of the array. Prints an error and returns [code]null[/code] if the array is empty.
[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> </description>
</method> </method>
<method name="has"> <method name="has">
@ -283,14 +285,14 @@
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Removes and returns the last element of the array. Returns [code]null[/code] if the array is empty. Removes and returns the last element of the array. Returns [code]null[/code] if the array is empty, without printing an error message.
</description> </description>
</method> </method>
<method name="pop_front"> <method name="pop_front">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Removes and returns the first element of the array. Returns [code]null[/code] if the array is empty. Removes and returns the first element of the array. Returns [code]null[/code] if the array is empty, wwithout printing an error message.
</description> </description>
</method> </method>
<method name="push_back"> <method name="push_back">
@ -317,7 +319,7 @@
<argument index="0" name="position" type="int"> <argument index="0" name="position" type="int">
</argument> </argument>
<description> <description>
Removes an element from the array by index. Removes an element from the array by index. If the index does not exist in the array, nothing happens.
</description> </description>
</method> </method>
<method name="resize"> <method name="resize">