math.deg

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

Returns number
API math
Source Lua (source)

Convert the number num from radians to degrees.

ExamplePrint the inverse sine of user input in degrees
Read a line from the user, compute its arcsin, then convert it to degrees.
Code
<nowiki>
print(math.deg(math.asin(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.