Var cap

From Sim Innovations Wiki
Jump to navigation Jump to search

Description

value = var_cap(value,min,max)

var_cap is used to limit a value to a given minimum and maximum value.

Return value

Argument Type Description
value Number Return value. This value is never greater than max value and never lower than min value.

Arguments

# Argument Type Description
1 value Number The is the value that needs to be limited to the min and max value.
2 min Number The minimum value to limit to.
3 max Number The maximum value to limit to.

Example

-- Returns 15
myvalue = var_cap(15,10,20)

-- Returns 10
myvalue = var_cap(9,10,20)

-- Returns 20
myvalue = var_cap(21,10,20)