Lua math functions

Lua math functions

These are the functions in the "math" table.

Trigonometry functions use radians. To convert degrees to radians use math.rad.
Or, to look at it another way:

radians = degrees * math.pi / 180
pi

The variable math.pi gives you the value of pi.

pi = math.pi
e

To use e in an expression you can use the math.exp function.

e = math.exp (1)
See also the "bc" (big number) library for functions that work with numbers to arbitrary precision.

Lua functions

Topics