Difference between revisions of "Math.clamp"

From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2022.1<br/> '''Class:''' math<br/> === Description === Returns a number between min and max, inclusive. <source lang="lua"> (numb...")
 
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
Returns a number between min and max, inclusive.
 
Returns a number between min and max, inclusive.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
(number) = math.clamp(v,min,max)
 
(number) = math.clamp(v,min,max)
</source>
+
</syntaxhighlight>
  
 
=== Parameters ===
 
=== Parameters ===

Latest revision as of 15:30, 13 July 2023

Available since: Gideros 2022.1
Class: math

Description

Returns a number between min and max, inclusive.

(number) = math.clamp(v,min,max)

Parameters

v: (number) number to clamp
min: (number) min possible value
max: (number) max possible value

Return values

Returns (number) the clamped number