Game Development Reference
In-Depth Information
math.tan (x)
This returns the tangent of the angle passed in radians.
print (math.tan(45)) -- 1.6197751905439
math.tanh (x)
This returns the hyperbolic tangent of a value.
print(math.tanh(1)) -- 0.76159415595576
x-axis , and the up-and-down movement is on the y-axis .
Assignment
The first thing that we shall look at is assignment. Remember the school days when we had
let x equal 5
let y equal 3
x + y = 5 + 3
= 8
This concept remains even today. With Lua, when we assign a variable a value, this value can be one
of the eight basic types discussed in the Chapter 1. The most commonly used ones are numbers,
strings, and tables.
The preceding algebraic equation would translate to the following:
x=5
y=3
print( "x+y=" .. x+y)
Increasing and Decreasing
If you are coming to Lua from a C/C++ background, you may be used to operator overloading. This
is why a lot of developers ask why Lua doesn't have the var++ or var-- operator to increment or
 
Search WWH ::




Custom Search