Improve documentation for Array operators

This commit is contained in:
Hugo Locurcio 2022-03-30 19:00:53 +02:00
parent 5ba3b993d5
commit de363db2a6
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C

View file

@ -513,56 +513,56 @@
<return type="bool" />
<argument index="0" name="right" type="Array" />
<description>
Compares the current array against the array passed as argument: Returns [code]false[/code] if the compared arrays are the same object. Returns [code]true[/code] if the compared arrays have different sizes. Returns [code]false[/code] and prints an error if the comparison reaches the highest levels of nesting (100). Returns [code]true[/code] if the contents of the arrays are not equal, [code]false[/code] otherwise.
Compares the left operand [Array] against the [code]right[/code] [Array]. Returns [code]true[/code] if the sizes or contents of the arrays are [i]not[/i] equal, [code]false[/code] otherwise.
</description>
</operator>
<operator name="operator +">
<return type="Array" />
<argument index="0" name="right" type="Array" />
<description>
This operator is actually provided by the [Variant] class. For further details, see the available documentation for [Variant] or refer to the Godot source code (core/variant/variant_op).
Concatenates two [Array]s together, with the [code]right[/code] [Array] being added to the end of the [Array] specified in the left operand. For example, [code][1, 2] + [3, 4][/code] results in [code][1, 2, 3, 4][/code].
</description>
</operator>
<operator name="operator &lt;">
<return type="bool" />
<argument index="0" name="right" type="Array" />
<description>
Performs a comparison for each index between the current array and the array passed as argument, considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is less, or [code]false[/code] if the element is greater. Note that depending on the type of data stored, this function will be recursive. If all elements are equal it compares the length of both arrays, it returns [code]false[/code] if the current array has less elements, returns [code]true[/code] otherwise.
Performs a comparison for each index between the left operand [Array] and the [code]right[/code] [Array], considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is less, or [code]false[/code] if the element is greater. Note that depending on the type of data stored, this function may be recursive. If all elements are equal, it compares the length of both arrays and returns [code]false[/code] if the left operand [Array] has less elements, otherwise it returns [code]true[/code].
</description>
</operator>
<operator name="operator &lt;=">
<return type="bool" />
<argument index="0" name="right" type="Array" />
<description>
Performs a comparison for each index between the current array and the array passed as argument, considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is less, or [code]false[/code] if the element is greater. Note that depending on the type of data stored, this function will be recursive. If all elements are equal it compares the length of both arrays, it returns [code]true[/code] if the current array has less or the same number of elements, otherwise it returns [code]false[/code].
Performs a comparison for each index between the left operand [Array] and the [code]right[/code] [Array], considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is less, or [code]false[/code] if the element is greater. Note that depending on the type of data stored, this function may be recursive. If all elements are equal, it compares the length of both arrays and returns [code]true[/code] if the left operand [Array] has less or the same number of elements, otherwise it returns [code]false[/code].
</description>
</operator>
<operator name="operator ==">
<return type="bool" />
<argument index="0" name="right" type="Array" />
<description>
Compares the current array against the array passed as argument: Returns [code]true[/code] if the compared arrays are the same object. Returns [code]false[/code] if the compared arrays have different sizes. Returns [code]true[/code] and prints an error if the comparison reaches the highest levels of nesting (100). Returns [code]false[/code] if the contents of the arrays are not equal, [code]true[/code] otherwise.
Compares the left operand [Array] against the [code]right[/code] [Array]. Returns [code]true[/code] if the sizes and contents of the arrays are equal, [code]false[/code] otherwise.
</description>
</operator>
<operator name="operator &gt;">
<return type="bool" />
<argument index="0" name="right" type="Array" />
<description>
Performs a comparison for each index between the current array and the array passed as argument, considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is greater, or [code]false[/code] if the element is less. Note that depending on the type of data stored, this function will be recursive. If all elements are equal it compares the length of both arrays, it returns [code]true[/code] if the array passed as argument has more elements, otherwise it returns [code]false[/code].
Performs a comparison for each index between the left operand [Array] and the [code]right[/code] [Array], considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is greater, or [code]false[/code] if the element is less. Note that depending on the type of data stored, this function may be recursive. If all elements are equal, it compares the length of both arrays and returns [code]true[/code] if the [code]right[/code] [Array] has more elements, otherwise it returns [code]false[/code].
</description>
</operator>
<operator name="operator &gt;=">
<return type="bool" />
<argument index="0" name="right" type="Array" />
<description>
Performs a comparison for each index between the current array and the array passed as argument, considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is greater, or [code]false[/code] if the element is less. Note that depending on the type of data stored, this function will be recursive. If all elements are equal it compares the length of both arrays, it returns [code]true[/code] if the array passed as argument has more or the same number of elements, otherwise it returns [code]false[/code].
Performs a comparison for each index between the left operand [Array] and the [code]right[/code] [Array], considering the highest common index of both arrays for this comparison: Returns [code]true[/code] on the first occurrence of an element that is greater, or [code]false[/code] if the element is less. Note that depending on the type of data stored, this function may be recursive. If all elements are equal, it compares the length of both arrays and returns [code]true[/code] if the [code]right[/code] [Array] has more or the same number of elements, otherwise it returns [code]false[/code].
</description>
</operator>
<operator name="operator []">
<return type="void" />
<argument index="0" name="index" type="int" />
<description>
Returns a reference to the element of type Variant at the specified location.
Returns a reference to the element of type [Variant] at the specified location. Arrays start at index 0. [code]index[/code] can be a zero or positive value to start from the beginning, or a negative value to start from the end. Out-of-bounds array access causes a run-time error, which will result in an error being printed and the project execution pausing if run from the editor.
</description>
</operator>
</operators>