Math
The Math module provides various extensions on Lua’s math library and other related utility
functions.
API
-
class Lua.Math:
LibTSMModule -
staticmethod GetNan():
number Returns NAN.
-
staticmethod IsNan(value:
number):boolean Checks if a value is NAN.
- Parameters:
value (
number) – The number to check
-
staticmethod Round(value:
number, sig?:number):number Rounds a value to a specified significant value.
- Parameters:
value (
number) – The number to be roundedsig? (
number) – The value to round to the nearest multiple of (defaults to 1)
-
staticmethod Floor(value:
number, sig?:number):number Rounds a value down to a specified significant value.
- Parameters:
value (
number) – The number to be roundedsig? (
number) – The value to round down to the nearest multiple of (defaults to 1)
-
staticmethod Ceil(value:
number, sig?:number):number Rounds a value up to a specified significant value.
- Parameters:
value (
number) – The number to be roundedsig? (
number) – The value to round up to the nearest multiple of (defaults to 1)
-
staticmethod Scale(
value:number,
fromStart:number,
fromEnd:number,
toStart:number,
toEnd:number
):number Scales a value from one range to another.
- Parameters:
value (
number) – The number to be scaledfromStart (
number) – The start value of the range to scale fromfromEnd (
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 totoEnd (
number) – The end value of the range to scale to (can be less than toStart)
-
staticmethod Bound(value:
number, minValue:number, maxValue:number):number Bounds a number between a min and max value.
- Parameters:
value (
number) – The number to be boundedminValue (
number) – The min valuemaxValue (
number) – The max value
-
staticmethod GetNan():