summaryrefslogtreecommitdiffstats
path: root/doc/classes
diff options
context:
space:
mode:
authorYuri Rubinsky <chaosus89@gmail.com>2022-06-27 12:37:55 +0300
committerYuri Rubinsky <chaosus89@gmail.com>2022-06-27 16:11:21 +0300
commit2476c50a663751844038cfdb0842164ec5e6e6a3 (patch)
tree97e4bbaaadcd74052ad3ed8d4307d699d7199c3d /doc/classes
parent898e09e2e63c221b861cc64b12adc80dc48ce5eb (diff)
downloadredot-engine-2476c50a663751844038cfdb0842164ec5e6e6a3.tar.gz
Add generalized version of `wrap` function
Diffstat (limited to 'doc/classes')
-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 475d166925..e031f9caba 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -1040,6 +1040,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" />