Reader small image

You're reading from  Lua Quick Start Guide

Product typeBook
Published inJul 2018
Reading LevelBeginner
PublisherPackt
ISBN-139781789343229
Edition1st Edition
Languages
Right arrow
Author (1)
Gabor Szauer
Gabor Szauer
author image
Gabor Szauer

Gabor Szauer has been making games since 2010. He graduated from Full Sail University in 2010 with a bachelor's degree in game development. Gabor maintains an active Twitter presence, and maintains a programming-oriented game development blog. Gabor's previously published books are Game Physics Programming Cookbook and Lua Quick Start Guide, both published by Packt.
Read more about Gabor Szauer

Right arrow

math

At some point, you are likely going to need to change some numbers around. Many mathematical functions such as sine or cosine are provided by Lua. To better understand the provided functions, this section will review Lua's math library.

The official math library documentation is online here: https://www.lua.org/manual/5.2/manual.html#pdf-math

Trigonometry

Some interactive applications such as games rely heavily on trigonometry. Trigonometry is used to figure out the distance between two points, to render a world, and much more. Lua provides the following trig functions. Remember, all of these functions return radians, not degrees:

  • math.acos(v): returns the inverse cosine of a number in radians
  • math.asin(v): returns...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Lua Quick Start Guide
Published in: Jul 2018Publisher: PacktISBN-13: 9781789343229

Author (1)

author image
Gabor Szauer

Gabor Szauer has been making games since 2010. He graduated from Full Sail University in 2010 with a bachelor's degree in game development. Gabor maintains an active Twitter presence, and maintains a programming-oriented game development blog. Gabor's previously published books are Game Physics Programming Cookbook and Lua Quick Start Guide, both published by Packt.
Read more about Gabor Szauer