math.floor

From ComputerCraft
Jump to: navigation, search

math.floor
Function
Syntax
math.floor()
Returns number
API math
Source Lua (source)

Return num rounded to the previous whole integer.

ExampleExampleRound the value of user input
Read a line from the user, then print the floor of the number they entered.
Code
print(math.floor(tonumber(read())))
Output Depends on what the user wrote. For instance, if they were to enter 0.2, the number printed would be 0.