From 74952764f3547fc86473a3b268c720bd5b48ba72 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sun, 6 Sep 2020 15:20:42 +0200 Subject: [PATCH] Improve documentation related to Array error handling This closes https://github.com/godotengine/godot-docs/issues/3834. (cherry picked from commit 263f620421773e74a0d5c0306c1453883dc205bb) --- doc/classes/Array.xml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 292c9ab0b97..2366b4e2be8 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -99,7 +99,8 @@ - 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. @@ -192,7 +193,8 @@ - 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. @@ -255,14 +257,14 @@ - 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. - 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. @@ -283,7 +285,7 @@ - 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.