math.floor
Return num rounded to the previous whole integer.
|
|||
| 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. |
||
Functions | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Lua |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| CC:Tweaked |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| math.floor Function | |
|---|---|
|
Syntax math.floor(
| |
| 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.