[DOCS] Minor classref updates.

This commit is contained in:
Chris Bradfield 2019-02-23 18:56:10 -08:00
parent ef61c14dda
commit 08c3a2241d
3 changed files with 50 additions and 32 deletions

View file

@ -4,7 +4,7 @@
Generic array datatype. Generic array datatype.
</brief_description> </brief_description>
<description> <description>
Generic array, contains 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.). Example:
[codeblock] [codeblock]
var array = ["One", 2, 3, "Four"] var array = ["One", 2, 3, "Four"]
print(array[0]) # One print(array[0]) # One
@ -26,7 +26,7 @@
<argument index="0" name="from" type="PoolColorArray"> <argument index="0" name="from" type="PoolColorArray">
</argument> </argument>
<description> <description>
Construct an array from a [PoolColorArray]. Constructs an array from a [PoolColorArray].
</description> </description>
</method> </method>
<method name="Array"> <method name="Array">
@ -35,7 +35,7 @@
<argument index="0" name="from" type="PoolVector3Array"> <argument index="0" name="from" type="PoolVector3Array">
</argument> </argument>
<description> <description>
Construct an array from a [PoolVector3Array]. Constructs an array from a [PoolVector3Array].
</description> </description>
</method> </method>
<method name="Array"> <method name="Array">
@ -44,7 +44,7 @@
<argument index="0" name="from" type="PoolVector2Array"> <argument index="0" name="from" type="PoolVector2Array">
</argument> </argument>
<description> <description>
Construct an array from a [PoolVector2Array]. Constructs an array from a [PoolVector2Array].
</description> </description>
</method> </method>
<method name="Array"> <method name="Array">
@ -53,7 +53,7 @@
<argument index="0" name="from" type="PoolStringArray"> <argument index="0" name="from" type="PoolStringArray">
</argument> </argument>
<description> <description>
Construct an array from a [PoolStringArray]. Constructs an array from a [PoolStringArray].
</description> </description>
</method> </method>
<method name="Array"> <method name="Array">
@ -62,7 +62,7 @@
<argument index="0" name="from" type="PoolRealArray"> <argument index="0" name="from" type="PoolRealArray">
</argument> </argument>
<description> <description>
Construct an array from a [PoolRealArray]. Constructs an array from a [PoolRealArray].
</description> </description>
</method> </method>
<method name="Array"> <method name="Array">
@ -71,7 +71,7 @@
<argument index="0" name="from" type="PoolIntArray"> <argument index="0" name="from" type="PoolIntArray">
</argument> </argument>
<description> <description>
Construct an array from a [PoolIntArray]. Constructs an array from a [PoolIntArray].
</description> </description>
</method> </method>
<method name="Array"> <method name="Array">
@ -80,21 +80,21 @@
<argument index="0" name="from" type="PoolByteArray"> <argument index="0" name="from" type="PoolByteArray">
</argument> </argument>
<description> <description>
Construct an array from a [PoolByteArray]. Constructs an array from a [PoolByteArray].
</description> </description>
</method> </method>
<method name="append"> <method name="append">
<argument index="0" name="value" type="Variant"> <argument index="0" name="value" type="Variant">
</argument> </argument>
<description> <description>
Append an element at the end of the array (alias of [method push_back]). Appends an element at the end of the array (alias of [method push_back]).
</description> </description>
</method> </method>
<method name="back"> <method name="back">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Returns the last element of the array if the array is not empty (size&gt;0). Returns the last element of the array if the array is not empty.
</description> </description>
</method> </method>
<method name="bsearch"> <method name="bsearch">
@ -125,7 +125,7 @@
</method> </method>
<method name="clear"> <method name="clear">
<description> <description>
Clear the array (resize to 0). Clears the array (resizes to 0).
</description> </description>
</method> </method>
<method name="count"> <method name="count">
@ -134,7 +134,7 @@
<argument index="0" name="value" type="Variant"> <argument index="0" name="value" type="Variant">
</argument> </argument>
<description> <description>
Return the amount of times an element is in the array. Returns the number of times an element is in the array.
</description> </description>
</method> </method>
<method name="duplicate"> <method name="duplicate">
@ -144,21 +144,21 @@
</argument> </argument>
<description> <description>
Returns a copy of the array. Returns a copy of the array.
If [code]deep[/code] is [code]true[/code], a deep copy is be performed: all nested arrays and dictionaries are duplicated and will not be shared with the original array. If [code]false[/code], a shallow copy is made and references to the original nested arrays and dictionaries are kept, so that modifying a sub-array or dictionary in the copy will also impact those referenced in the source array. If [code]deep[/code] is [code]true[/code], a deep copy is performed: all nested arrays and dictionaries are duplicated and will not be shared with the original array. If [code]false[/code], a shallow copy is made and references to the original nested arrays and dictionaries are kept, so that modifying a sub-array or dictionary in the copy will also impact those referenced in the source array.
</description> </description>
</method> </method>
<method name="empty"> <method name="empty">
<return type="bool"> <return type="bool">
</return> </return>
<description> <description>
Return true if the array is empty (size==0). Returns [code]true[/code] if the array is empty.
</description> </description>
</method> </method>
<method name="erase"> <method name="erase">
<argument index="0" name="value" type="Variant"> <argument index="0" name="value" type="Variant">
</argument> </argument>
<description> <description>
Remove the first occurrence of a value from the array. Removes the first occurrence of a value from the array.
</description> </description>
</method> </method>
<method name="find"> <method name="find">
@ -185,7 +185,7 @@
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Returns the first element of the array if the array is not empty (size&gt;0). Returns the first element of the array if the array is not empty.
</description> </description>
</method> </method>
<method name="has"> <method name="has">
@ -194,7 +194,7 @@
<argument index="0" name="value" type="Variant"> <argument index="0" name="value" type="Variant">
</argument> </argument>
<description> <description>
Return true if the array contains given value. Returns [code]true[/code] if the array contains the given value.
[codeblock] [codeblock]
["inside", 7].has("inside") == true ["inside", 7].has("inside") == true
["inside", 7].has("outside") == false ["inside", 7].has("outside") == false
@ -207,7 +207,7 @@
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return a hashed integer value representing the array contents. Returns a hashed integer value representing the array contents.
</description> </description>
</method> </method>
<method name="insert"> <method name="insert">
@ -216,68 +216,68 @@
<argument index="1" name="value" type="Variant"> <argument index="1" name="value" type="Variant">
</argument> </argument>
<description> <description>
Insert a new element at a given position in the array. The position must be valid, or at the end of the array ([code]pos == size()[/code]). Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]pos == size()[/code]).
</description> </description>
</method> </method>
<method name="invert"> <method name="invert">
<description> <description>
Reverse the order of the elements in the array. Reverses the order of the elements in the array.
</description> </description>
</method> </method>
<method name="max"> <method name="max">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Return maximum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. Returns the maximum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned.
</description> </description>
</method> </method>
<method name="min"> <method name="min">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Return minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned. Returns the minimum value contained in the array if all elements are of comparable types. If the elements can't be compared, [code]null[/code] is returned.
</description> </description>
</method> </method>
<method name="pop_back"> <method name="pop_back">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Remove the last element of the array. Removes the last element of the array.
</description> </description>
</method> </method>
<method name="pop_front"> <method name="pop_front">
<return type="Variant"> <return type="Variant">
</return> </return>
<description> <description>
Remove the first element of the array. Removes the first element of the array.
</description> </description>
</method> </method>
<method name="push_back"> <method name="push_back">
<argument index="0" name="value" type="Variant"> <argument index="0" name="value" type="Variant">
</argument> </argument>
<description> <description>
Append an element at the end of the array. Appends an element at the end of the array.
</description> </description>
</method> </method>
<method name="push_front"> <method name="push_front">
<argument index="0" name="value" type="Variant"> <argument index="0" name="value" type="Variant">
</argument> </argument>
<description> <description>
Add an element at the beginning of the array. Adds an element at the beginning of the array.
</description> </description>
</method> </method>
<method name="remove"> <method name="remove">
<argument index="0" name="position" type="int"> <argument index="0" name="position" type="int">
</argument> </argument>
<description> <description>
Remove an element from the array by index. Removes an element from the array by index.
</description> </description>
</method> </method>
<method name="resize"> <method name="resize">
<argument index="0" name="size" type="int"> <argument index="0" name="size" type="int">
</argument> </argument>
<description> <description>
Resize 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 Null.
</description> </description>
</method> </method>
<method name="rfind"> <method name="rfind">
@ -293,19 +293,19 @@
</method> </method>
<method name="shuffle"> <method name="shuffle">
<description> <description>
Shuffle the array such that the items will have a random order. Shuffles the array such that the items will have a random order.
</description> </description>
</method> </method>
<method name="size"> <method name="size">
<return type="int"> <return type="int">
</return> </return>
<description> <description>
Return the amount of elements in the array. Returns the number of elements in the array.
</description> </description>
</method> </method>
<method name="sort"> <method name="sort">
<description> <description>
Sort the array using natural order. Sorts the array. Note: strings are sorted in alphabetical, not natural order.
</description> </description>
</method> </method>
<method name="sort_custom"> <method name="sort_custom">
@ -314,7 +314,7 @@
<argument index="1" name="func" type="String"> <argument index="1" name="func" type="String">
</argument> </argument>
<description> <description>
Sort the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Sorts the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise.
[b]Note:[/b] you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior. [b]Note:[/b] you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
[codeblock] [codeblock]
class MyCustomSorter: class MyCustomSorter:

View file

@ -64,6 +64,13 @@
</argument> </argument>
<description> <description>
Returns a [SceneTreeTimer] which will [signal SceneTreeTimer.timeout] after the given time in seconds elapsed in this SceneTree. If [code]pause_mode_process[/code] is set to false, pausing the SceneTree will also pause the timer. Returns a [SceneTreeTimer] which will [signal SceneTreeTimer.timeout] after the given time in seconds elapsed in this SceneTree. If [code]pause_mode_process[/code] is set to false, pausing the SceneTree will also pause the timer.
Commonly used to create a one-shot delay timer as in the following example:
[codeblock]
func some_function():
print("start")
yield(get_tree().create_timer(1.0), "timeout")
print("end")
[/codeblock]
</description> </description>
</method> </method>
<method name="get_frame" qualifiers="const"> <method name="get_frame" qualifiers="const">

View file

@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<class name="SceneTreeTimer" inherits="Reference" category="Core" version="3.1"> <class name="SceneTreeTimer" inherits="Reference" category="Core" version="3.1">
<brief_description> <brief_description>
One-shot timer.
</brief_description> </brief_description>
<description> <description>
A one-shot timer managed by the scene tree, which emits [signal timeout] on completion. See also [method SceneTree.create_timer].
As opposed to a [class Timer], does not require the instantiation of a node. Commonly used to create a one-shot delay timer as in the following example:
[codeblock]
func some_function():
print("start")
yield(get_tree().create_timer(1.0), "timeout")
print("end")
[/codeblock]
</description> </description>
<tutorials> <tutorials>
</tutorials> </tutorials>
@ -12,11 +21,13 @@
</methods> </methods>
<members> <members>
<member name="time_left" type="float" setter="set_time_left" getter="get_time_left"> <member name="time_left" type="float" setter="set_time_left" getter="get_time_left">
The time remaining.
</member> </member>
</members> </members>
<signals> <signals>
<signal name="timeout"> <signal name="timeout">
<description> <description>
Emitted when the timer reaches 0.
</description> </description>
</signal> </signal>
</signals> </signals>