diff options
Diffstat (limited to 'doc/classes/Array.xml')
-rw-r--r-- | doc/classes/Array.xml | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index ecafc3514c..130908b842 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -4,7 +4,8 @@ Generic array datatype. </brief_description> <description> - Generic array which can contain several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 the second to last, etc.). Example: + Generic array which can contain several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 the second to last, etc.). + [b]Example:[/b] [codeblock] var array = ["One", 2, 3, "Four"] print(array[0]) # One @@ -103,7 +104,8 @@ <argument index="1" name="before" type="bool" default="True"> </argument> <description> - Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a before specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. Note that calling bsearch on an unsorted array results in unexpected behavior. + Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [code]before[/code] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. + [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. </description> </method> <method name="bsearch_custom"> @@ -118,12 +120,13 @@ <argument index="3" name="before" type="bool" default="True"> </argument> <description> - Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a before specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return [code]true[/code] if the first argument is less than the second, and return [code]false[/code] otherwise. Note that calling bsearch on an unsorted array results in unexpected behavior. + Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a [code]before[/code] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return [code]true[/code] if the first argument is less than the second, and return [code]false[/code] otherwise. + [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. </description> </method> <method name="clear"> <description> - Clears the array (resizes to 0). + Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code]. </description> </method> <method name="count"> @@ -275,7 +278,7 @@ <argument index="0" name="size" type="int"> </argument> <description> - Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are Null. + Resizes the array to contain a different number of elements. If the array size is smaller, elements are cleared, if bigger, new elements are [code]null[/code]. </description> </method> <method name="rfind"> @@ -291,7 +294,7 @@ </method> <method name="shuffle"> <description> - Shuffles the array such that the items will have a random order. + Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as [method @GDScript.randi]. Call [method @GDScript.randomize] to ensure that a new seed will be used each time if you want non-reproducible shuffling. </description> </method> <method name="size"> @@ -303,7 +306,8 @@ </method> <method name="sort"> <description> - Sorts the array. Note: strings are sorted in alphabetical, not natural order. + Sorts the array. + [b]Note:[/b] strings are sorted in alphabetical, not natural order. </description> </method> <method name="sort_custom"> |