Browse Source

Merge pull request #104258 from Monochrome-debug/documentation_change

Improve documentation for return value of `Packed*Array.resize`
Rémi Verschelde 5 months ago
parent
commit
5595d8246e

+ 1 - 1
doc/classes/Array.xml

@@ -674,7 +674,7 @@
 			<param index="0" name="size" type="int" />
 			<param index="0" name="size" type="int" />
 			<description>
 			<description>
 				Sets the array's number of elements to [param size]. If [param size] is smaller than the array's current size, the elements at the end are removed. If [param size] is greater, new default elements (usually [code]null[/code]) are added, depending on the array's type.
 				Sets the array's number of elements to [param size]. If [param size] is smaller than the array's current size, the elements at the end are removed. If [param size] is greater, new default elements (usually [code]null[/code]) are added, depending on the array's type.
-				Returns [constant OK] on success, or one of the other [enum Error] constants if this method fails.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_LOCKED] if the array is read-only, [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 				[b]Note:[/b] Calling this method once and assigning the new values is faster than calling [method append] for every new element.
 				[b]Note:[/b] Calling this method once and assigning the new values is faster than calling [method append] for every new element.
 			</description>
 			</description>
 		</method>
 		</method>

+ 1 - 0
doc/classes/PackedByteArray.xml

@@ -415,6 +415,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedColorArray.xml

@@ -148,6 +148,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedFloat32Array.xml

@@ -149,6 +149,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedFloat64Array.xml

@@ -150,6 +150,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedInt32Array.xml

@@ -144,6 +144,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedInt64Array.xml

@@ -145,6 +145,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedStringArray.xml

@@ -151,6 +151,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedVector2Array.xml

@@ -154,6 +154,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 1 - 0
doc/classes/PackedVector3Array.xml

@@ -153,6 +153,7 @@
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
 				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">

+ 2 - 1
doc/classes/PackedVector4Array.xml

@@ -152,7 +152,8 @@
 			<return type="int" />
 			<return type="int" />
 			<param index="0" name="new_size" type="int" />
 			<param index="0" name="new_size" type="int" />
 			<description>
 			<description>
-				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size.
+				Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
+				Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
 			</description>
 			</description>
 		</method>
 		</method>
 		<method name="reverse">
 		<method name="reverse">