math.rad

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

Returns number
API math
Source Lua (source)

Convert the number num from degrees to radians.

ExamplePrint the sine of user input
Read a line from the user, convert it to radians, then print its math.sin.
Code
<nowiki>
print(math.sin(math.rad(tonumber(read())))
    </nowiki>
Output Depends on what the user wrote. For instance, if they were to enter -1, the number printed would be -90.
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.