Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 619 Bytes

math.md

File metadata and controls

33 lines (20 loc) · 619 Bytes

Math

math

The math library is a standard Lua library. It is a global library and does not need to be imported.

print(math.abs(-123));  -- 123

Refer to the official Lua documentation for more details.

extensions

The math library has been extended with some additional functions.

math.round( x )

Rounds the value x to the nearest integer (rounds 0.5 up).

print(math.round(1.25));  -- 1
print(math.round(1.5));	  -- 2
print(math.round(1.75));  -- 2