math
abs
function math.abs(x: <Number:number>)
-> <Number:number>
Returns the absolute value of x.
acos
function math.acos(x: number)
-> number
Returns the arc cosine of x (in radians).
asin
function math.asin(x: number)
-> number
Returns the arc sine of x (in radians).
atan
function math.atan(y: number, x?: number)
-> number
Returns the arc tangent of y/x (in radians).
atan2
function math.atan2(y: number, x: number)
-> number
Returns the arc tangent of y/x (in radians).
ceil
function math.ceil(x: number)
-> integer
Returns the smallest integral value larger than or equal to x.
cos
function math.cos(x: number)
-> number
Returns the cosine of x (assumed to be in radians).
cosh
function math.cosh(x: number)
-> number
Returns the hyperbolic cosine of x (assumed to be in radians).
deg
function math.deg(x: number)
-> number
Converts the angle x from radians to degrees.
exp
function math.exp(x: number)
-> number
Returns the value e^x (where e is the base of natural logarithms).
floor
function math.floor(x: number)
-> integer
Returns the largest integral value smaller than or equal to x.
fmod
function math.fmod(x: number, y: number)
-> number
Returns the remainder of the division of x by y that rounds the quotient towards zero.
frexp
function math.frexp(x: number)
-> m: number
2. e: number
Decompose x into tails and exponents. Returns m and e such that x = m * (2 ^ e), e is an integer and the absolute value of m is in the range [0.5, 1) (or zero when x is zero).
ldexp
function math.ldexp(m: number, e: number)
-> number
Returns m * (2 ^ e) .
log
function math.log(x: number, base?: integer)
-> number
Returns the logarithm of x in the given base.
log10
function math.log10(x: number)
-> number
Returns the base-10 logarithm of x.
max
function math.max(x: <Number:number>, ...<Number:number>)
-> <Number:number>
Returns the argument with the maximum value, according to the Lua operator <.
min
function math.min(x: <Number:number>, ...<Number:number>)
-> <Number:number>
Returns the argument with the minimum value, according to the Lua operator <.
modf
function math.modf(x: number)
-> integer
2. number
Returns the integral part of x and the fractional part of x.
pow
function math.pow(x: number, y: number)
-> number
Returns x ^ y .
rad
function math.rad(x: number)
-> number
Converts the angle x from degrees to radians.
random
function math.random(m: integer, n: integer)
-> integer
math.random(): Returns a float in the range [0,1).math.random(n): Returns a integer in the range [1, n].math.random(m, n): Returns a integer in the range [m, n].
randomseed
function math.randomseed(x?: integer, y?: integer)
math.randomseed(x, y): Concatenatexandyinto a 128-bitseedto reinitialize the pseudo-random generator.math.randomseed(x): Equate tomath.randomseed(x, 0).math.randomseed(): Generates a seed with a weak attempt for randomness.
sin
function math.sin(x: number)
-> number
Returns the sine of x (assumed to be in radians).
sinh
function math.sinh(x: number)
-> number
Returns the hyperbolic sine of x (assumed to be in radians).
sqrt
function math.sqrt(x: number)
-> number
Returns the square root of x.
tan
function math.tan(x: number)
-> number
Returns the tangent of x (assumed to be in radians).
tanh
function math.tanh(x: number)
-> number
Returns the hyperbolic tangent of x (assumed to be in radians).
tointeger
function math.tointeger(x: any)
-> integer?
type
function math.type(x: any)
-> "float"|"integer"|'nil'
return #1:
| "integer"
| "float"
| 'nil'ult
function math.ult(m: integer, n: integer)
-> boolean