6.7 – Mathematical Functions

This library provides basic mathematical functions. It provides all its functions and constants inside the table math. Functions with the annotation "integer/float" give integer results for integer arguments and float results for float (or mixed) arguments. Rounding functions (math.ceil, math.floor, and math.modf) return an integer when the result fits in the range of an integer, or a float otherwise.

math.mininteger
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.mininteger

2025-01-10 15:47:30
math.abs()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.abs (x) Returns the absolute value of x. (integer/float)

2025-01-10 15:47:30
math.randomseed()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.randomseed (x) Sets x as the "seed" for the pseudo-random generator: equal seeds produce equal sequences of numbers.

2025-01-10 15:47:30
math.floor()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.floor (x) Returns the largest integral value smaller than or equal to x.

2025-01-10 15:47:30
math.random()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.random ([m [, n]]) When called without arguments, returns a pseudo-random float with uniform distribution in the range [0,1). When called with two integers m

2025-01-10 15:47:30
math.type()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.type (x) Returns "integer" if x is an integer, "float" if it is a float, or nil if x is not a number.

2025-01-10 15:47:30
math.rad()
  • References/Lua/Lua/Standard Libraries/Mathematical Functions

math.rad (x) Converts the angle x from degrees to radians.

2025-01-10 15:47:30