Merge pull request #106369 from Calinou/doc-array-get

Improve documentation for `Array.get()` and `Packed*Array.get()` methods
This commit is contained in:
Thaddeus Crews 2025-06-02 18:51:20 -05:00
commit d7d6bc77ed
No known key found for this signature in database
GPG Key ID: 8C6E5FEB5FC03CCC
11 changed files with 22 additions and 11 deletions

View File

@ -435,7 +435,8 @@
<return type="Variant" />
<param index="0" name="index" type="int" />
<description>
Returns the element at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the element at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]null[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="get_typed_builtin" qualifiers="const">

View File

@ -342,7 +342,8 @@
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the byte at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the byte at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]0[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="get_string_from_ascii" qualifiers="const">

View File

@ -105,7 +105,8 @@
<return type="Color" />
<param index="0" name="index" type="int" />
<description>
Returns the [Color] at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the [Color] at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]Color(0, 0, 0, 1)[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -105,7 +105,8 @@
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the 32-bit float at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the 32-bit float at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]0.0[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -106,7 +106,8 @@
<return type="float" />
<param index="0" name="index" type="int" />
<description>
Returns the 64-bit float at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the 64-bit float at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]0.0[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -101,7 +101,8 @@
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the 32-bit integer at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the 32-bit integer at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]0[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -102,7 +102,8 @@
<return type="int" />
<param index="0" name="index" type="int" />
<description>
Returns the 64-bit integer at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the 64-bit integer at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]0[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -108,7 +108,8 @@
<return type="String" />
<param index="0" name="index" type="int" />
<description>
Returns the [String] at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the [String] at the given [param index] in the array. Returns an empty string and prints an error if the access is out of bounds. Negative indices are not supported; they will always consider the value to be out of bounds and return an empty string.
This is similar to using the [code][][/code] operator ([code]array[index][/code]), except that operator supports negative indices and causes a debugger break if out-of-bounds access is performed.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -110,7 +110,8 @@
<return type="Vector2" />
<param index="0" name="index" type="int" />
<description>
Returns the [Vector2] at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the [Vector2] at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]Vector2(0, 0)[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -109,7 +109,8 @@
<return type="Vector3" />
<param index="0" name="index" type="int" />
<description>
Returns the [Vector3] at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the [Vector3] at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]Vector3(0, 0, 0)[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">

View File

@ -109,7 +109,8 @@
<return type="Vector4" />
<param index="0" name="index" type="int" />
<description>
Returns the [Vector4] at the given [param index] in the array. This is the same as using the [code][][/code] operator ([code]array[index][/code]).
Returns the [Vector4] at the given [param index] in the array. If [param index] out-of-bounds or negative, this method fails and returns [code]Vector4(0, 0, 0, 0)[/code].
This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
</description>
</method>
<method name="has" qualifiers="const">