July 2018
Beginner
202 pages
5h 42m
English
Lua does not know the difference between a whole number and a decimal. All numbers are simply real numbers. Sometimes, especially when working with grids, you might need only whole numbers. If that is the case, Lua has a built-in function to round down, math.floor, or to round up, math.ceil. This is how they can be used:
pi = 3.1415three = math.floor(3.1415)five = math.ceil(4.145)print (pi) -- will print: 3.1415print (three) -- will print: 3print (five) -- will print: 5
Basic arithmetic operations such as adding, subtracting, multiplying, or dividing can be performed on integers. We will cover arithmetic operations in ...