summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-06-27 23:28:37 +0200
committerGitHub <noreply@github.com>2022-06-27 23:28:37 +0200
commit8fd0b4d1f84867c6727e2e233ad08b1fed801eb7 (patch)
tree06add852f07c8b4792366e30b0bc0019c3a58f03 /doc
parentc4a426d6ec71865b971ad419bf925ce8b8f9c37b (diff)
parent2476c50a663751844038cfdb0842164ec5e6e6a3 (diff)
Merge pull request #62449 from Chaosus/wrap_func
Add generalized version of `wrap` function
Diffstat (limited to 'doc')
-rw-r--r--doc/classes/@GlobalScope.xml21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index aa44f21149..e06863be7a 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1051,6 +1051,27 @@
A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it.
</description>
</method>
+ <method name="wrap">
+ <return type="Variant" />
+ <argument index="0" name="value" type="Variant" />
+ <argument index="1" name="min" type="Variant" />
+ <argument index="2" name="max" type="Variant" />
+ <description>
+ Wraps the [Variant] [code]value[/code] between [code]min[/code] and [code]max[/code].
+ Usable for creating loop-alike behavior or infinite surfaces.
+ Variant types [int] and [float] (real) are supported. If any of the argument is [float] the result will be [float], otherwise it is [int].
+ [codeblock]
+ var a = wrap(4, 5, 10)
+ # a is 9 (int)
+
+ var a = wrap(7, 5, 10)
+ # a is 7 (int)
+
+ var a = wrap(10.5, 5, 10)
+ # a is 5.5 (float)
+ [/codeblock]
+ </description>
+ </method>
<method name="wrapf">
<return type="float" />
<argument index="0" name="value" type="float" />