Lua acos()

Anonymous contributor's avatar
Anonymous contributor
Published Oct 14, 2023

The acos() method of the Lua math library returns the arc cosine of the argument, in radians.

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Lua, a general-purpose programming language used for building games, web apps, and developer tools.
    • Beginner Friendly.
      4 hours

Syntax

math.acos(x)

Where -1 <= x <= 1.

Example

The code below will print the arc cosine of 0.5 to the console.

print(math.acos(0.5))

The output will be:

1.0471975511966

All contributors

Learn Lua on Codecademy

  • Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
    • Includes 6 Courses
    • With Professional Certification
    • Beginner Friendly.
      75 hours
  • Learn the basics of Lua, a general-purpose programming language used for building games, web apps, and developer tools.
    • Beginner Friendly.
      4 hours