summaryrefslogtreecommitdiff
path: root/doc/classes/@GDScript.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/@GDScript.xml')
-rw-r--r--doc/classes/@GDScript.xml98
1 files changed, 80 insertions, 18 deletions
diff --git a/doc/classes/@GDScript.xml b/doc/classes/@GDScript.xml
index 2bdfc56c44..22834a4c81 100644
--- a/doc/classes/@GDScript.xml
+++ b/doc/classes/@GDScript.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<class name="@GDScript" category="Core" version="3.1">
+<class name="@GDScript" category="Core" version="3.2">
<brief_description>
Built-in GDScript functions.
</brief_description>
@@ -8,8 +8,6 @@
</description>
<tutorials>
</tutorials>
- <demos>
- </demos>
<methods>
<method name="Color8">
<return type="Color">
@@ -94,7 +92,7 @@
<argument index="0" name="condition" type="bool">
</argument>
<description>
- Assert that the [code]condition[/code] is true. If the [code]condition[/code] is false a fatal error is generated and the program is halted. Useful for debugging to make sure a value is always true.
+ Assert that the [code]condition[/code] is [code]true[/code] . If the [code]condition[/code] is [code]false[/code] a fatal error is generated and the program is halted. Useful for debugging to make sure a value is always [code]true[/code].
[codeblock]
# Speed should always be between 0 and 20
speed = -10
@@ -127,7 +125,7 @@
<description>
Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant.
[codeblock]
- a = atan(0, -1) # a is 3.141593
+ a = atan2(0, -1) # a is 3.141593
[/codeblock]
</description>
</method>
@@ -136,8 +134,11 @@
</return>
<argument index="0" name="bytes" type="PoolByteArray">
</argument>
+ <argument index="1" name="allow_objects" type="bool" default="false">
+ </argument>
<description>
- Decodes a byte array back to a value.
+ Decodes a byte array back to a value. When [code]allow_objects[/code] is [code]true[/code] decoding objects is allowed.
+ [b]WARNING:[/b] Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution).
</description>
</method>
<method name="cartesian2polar">
@@ -415,6 +416,21 @@
<return type="Array">
</return>
<description>
+ Returns an array of dictionaries representing the current call stack.
+ [codeblock]
+ func _ready():
+ foo()
+
+ func foo():
+ bar()
+
+ func bar():
+ print(get_stack())
+ [/codeblock]
+ would print
+ [codeblock]
+ [{function:bar, line:12, source:res://script.gd}, {function:foo, line:9, source:res://script.gd}, {function:_ready, line:6, source:res://script.gd}]
+ [/codeblock]
</description>
</method>
<method name="hash">
@@ -482,13 +498,24 @@
[/codeblock]
</description>
</method>
+ <method name="is_equal_approx">
+ <return type="bool">
+ </return>
+ <argument index="0" name="a" type="float">
+ </argument>
+ <argument index="1" name="b" type="float">
+ </argument>
+ <description>
+ Returns True/False whether [code]a[/code] and [code]b[/code] are approximately equal to each other.
+ </description>
+ </method>
<method name="is_inf">
<return type="bool">
</return>
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns True/False whether [code]s[/code] is an infinity value (either positive infinity or negative infinity).
+ Returns whether [code]s[/code] is an infinity value (either positive infinity or negative infinity).
</description>
</method>
<method name="is_instance_valid">
@@ -497,6 +524,7 @@
<argument index="0" name="instance" type="Object">
</argument>
<description>
+ Returns whether [code]instance[/code] is a valid object (e.g. has not been deleted from memory).
</description>
</method>
<method name="is_nan">
@@ -505,7 +533,16 @@
<argument index="0" name="s" type="float">
</argument>
<description>
- Returns True/False whether [code]s[/code] is a NaN (Not-A-Number) value.
+ Returns whether [code]s[/code] is a NaN (Not-A-Number) value.
+ </description>
+ </method>
+ <method name="is_zero_approx">
+ <return type="bool">
+ </return>
+ <argument index="0" name="s" type="float">
+ </argument>
+ <description>
+ Returns True/False whether [code]s[/code] is zero or almost zero.
</description>
</method>
<method name="len">
@@ -523,7 +560,7 @@
</description>
</method>
<method name="lerp">
- <return type="float">
+ <return type="Variant">
</return>
<argument index="0" name="from" type="Variant">
</argument>
@@ -533,8 +570,11 @@
</argument>
<description>
Linearly interpolates between two values by a normalized value.
+ If the [code]from[/code] and [code]to[/code] arguments are of type [int] or [float], the return value is a [float].
+ If both are of the same vector type ([Vector2], [Vector3] or [Color]), the return value will be of the same type ([code]lerp[/code] then calls the vector type's [code]linear_interpolate[/code] method).
[codeblock]
- lerp(1, 3, 0.5) # returns 2
+ lerp(0, 4, 0.75) # returns 3.0
+ lerp(Vector2(1, 5), Vector2(3, 2), 0.5) # returns Vector2(2, 3.5)
[/codeblock]
</description>
</method>
@@ -690,6 +730,7 @@
<return type="void">
</return>
<description>
+ Like [method print], but prints only when used in debug mode.
</description>
</method>
<method name="print_stack">
@@ -791,7 +832,7 @@
<description>
Random range, any floating point value between [code]from[/code] and [code]to[/code].
[codeblock]
- prints(rand_range(0, 1), rand_range(0, 1)) # prints 0.135591 0.405263
+ prints(rand_range(0, 1), rand_range(0, 1)) # prints e.g. 0.135591 0.405263
[/codeblock]
</description>
</method>
@@ -808,9 +849,9 @@
<return type="float">
</return>
<description>
- Returns a random floating point value between 0 and 1.
+ Returns a random floating point value on the interval [code][0, 1][/code].
[codeblock]
- randf() # returns 0.375671
+ randf() # returns e.g. 0.375671
[/codeblock]
</description>
</method>
@@ -818,11 +859,12 @@
<return type="int">
</return>
<description>
- Returns a random 32 bit integer. Use remainder to obtain a random value between 0 and N (where N is smaller than 2^32 -1).
+ Returns a random unsigned 32 bit integer. Use remainder to obtain a random value in the interval [code][0, N][/code] (where N is smaller than 2^32 -1).
[codeblock]
- randi() % 20 # returns random number between 0 and 19
- randi() % 100 # returns random number between 0 and 99
- randi() % 100 + 1 # returns random number between 1 and 100
+ randi() # returns random integer between 0 and 2^32 - 1
+ randi() % 20 # returns random integer between 0 and 19
+ randi() % 100 # returns random integer between 0 and 99
+ randi() % 100 + 1 # returns random integer between 1 and 100
[/codeblock]
</description>
</method>
@@ -951,6 +993,24 @@
[/codeblock]
</description>
</method>
+ <method name="smoothstep">
+ <return type="float">
+ </return>
+ <argument index="0" name="from" type="float">
+ </argument>
+ <argument index="1" name="to" type="float">
+ </argument>
+ <argument index="2" name="weight" type="float">
+ </argument>
+ <description>
+ Returns a number smoothly interpolated between the [code]from[/code] and [code]to[/code], based on the [code]weight[/code]. Similar to [method lerp], but interpolates faster at the beginning and slower at the end.
+ [codeblock]
+ smoothstep(0, 2, 0.5) # returns 0.15
+ smoothstep(0, 2, 1.0) # returns 0.5
+ smoothstep(0, 2, 2.0) # returns 1.0
+ [/codeblock]
+ </description>
+ </method>
<method name="sqrt">
<return type="float">
</return>
@@ -1091,8 +1151,10 @@
</return>
<argument index="0" name="var" type="Variant">
</argument>
+ <argument index="1" name="full_objects" type="bool" default="false">
+ </argument>
<description>
- Encodes a variable value to a byte array.
+ Encodes a variable value to a byte array. When [code]full_objects[/code] is [code]true[/code] encoding objects is allowed (and can potentially include code).
</description>
</method>
<method name="var2str">