Appearance
Math
Inherits: LibTSMModule
Functions
Bound
lua
function Lua.Math.Bound(value, minValue, maxValue)
-> numberBounds a number between a min and max value.
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The number to be bounded |
minValue | number | The min value |
maxValue | number | The max value |
Returns:
| Type | Description |
|---|---|
number |
Ceil
lua
function Lua.Math.Ceil(value, sig)
-> numberRounds a value up to a specified significant value.
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The number to be rounded |
sig | number | The value to round up to the nearest multiple of (defaults to 1) |
Returns:
| Type | Description |
|---|---|
number |
Floor
lua
function Lua.Math.Floor(value, sig)
-> numberRounds a value down to a specified significant value.
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The number to be rounded |
sig | number | The value to round down to the nearest multiple of (defaults to 1) |
Returns:
| Type | Description |
|---|---|
number |
GetNan
lua
function Lua.Math.GetNan()
-> numberReturns NAN.
Returns:
| Type | Description |
|---|---|
number |
IsNan
lua
function Lua.Math.IsNan(value)
-> booleanChecks if a value is NAN.
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The number to check |
Returns:
| Type | Description |
|---|---|
boolean |
Round
lua
function Lua.Math.Round(value, sig)
-> numberRounds a value to a specified significant value.
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The number to be rounded |
sig | number | The value to round to the nearest multiple of (defaults to 1) |
Returns:
| Type | Description |
|---|---|
number |
Scale
lua
function Lua.Math.Scale(value, fromStart, fromEnd, toStart, toEnd)
-> numberScales a value from one range to another.
Parameters:
| Name | Type | Description |
|---|---|---|
value | number | The number to be scaled |
fromStart | number | The start value of the range to scale from |
fromEnd | number | The end value of the range to scale from (can be less than fromStart) |
toStart | number | The start value of the range to scale to |
toEnd | number | The end value of the range to scale to (can be less than toStart) |
Returns:
| Type | Description |
|---|---|
number |