math.floor

Return num rounded to the previous whole integer.

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

math.floor
Function
Syntax
math.floor(
  • num : number
)

Returns number
API math
Source Lua (source)
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.