API Reference

Math

Standard Luau math library. All functions are available in any Ionize script.

Available Functions

FunctionDescription
math.absReturns the absolute value of x.
math.acosReturns the arc cosine of x (in radians).
math.asinReturns the arc sine of x (in radians).
math.atanReturns the arc tangent of x (in radians).
math.atan2Returns the arc tangent of y/x (in radians).
math.ceilReturns the smallest integral value larger than or equal to x.
math.clampReturns a number between min and max, inclusive. If x is below min or above max, it will return min or max respectively.
math.coshReturns the hyperbolic cosine of x (assumed to be in radians).
math.degConverts the angle x from radians to degrees.
math.expReturns the value e^x (where e is the base of natural logarithms).
math.floorReturns the largest integral value smaller than or equal to x.
math.fmodReturns the remainder of the division of x by y that rounds the quotient towards zero.
math.frexpDecompose 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).
math.ldexpReturns m * (2 ^ e).
math.logReturns the logarithm of x in the given base.
math.log10Returns the base 10 logarithm of x.
math.maxReturns the argument with the maximum value, according to the Lua operator <.
math.minReturns the argument with the minimum value, according to the Lua operator <.
math.modfReturns the integral part of x and the fractional part of x.
math.noiseReturns a value roughly between negative 0.5 and 0.5 generated from its arguments.
math.powReturns x ^ y.
math.radConverts the angle x from degrees to radians.
math.random* 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].
math.randomseedSets x as the "seed" for the pseudo random generator.
math.roundRounds x to the nearest integer; rounds away from zero if we're midway between two integers.
math.signReturns negative 1 if x < 0, 0 if x == 0, or 1 if x > 0.
math.sinReturns the sine of x (assumed to be in radians).
math.sinhReturns the hyperbolic sine of x (assumed to be in radians).
math.sqrtReturns the square root of x.
math.tanReturns the tangent of x (assumed to be in radians).
math.tanhReturns the hyperbolic tangent of x (assumed to be in radians).