the expression `x^y` to compute this
value.)
math.rad({x}) *math.rad()*
Returns the angle {x} (given in degrees) in radians.
math.random([{m} [, {n}]]) *math.random()*
This function is an interface to the simple pseudo-random generator
function `rand` provided by ANSI C. (No guarantees can be given for
its statistical properties.)
When called without arguments, returns a pseudo-random real number in
the range `[0,1)`. When called with a number {m}, `math.random`
returns a pseudo-random integer in the range `[1, m]`. When called
with two numbers {m} and {n}, `math.random` returns a pseudo-random
integer in the range `[m, n]`.
math.randomseed({x}) *math.randomseed()*
Sets {x} as the "seed" for the pseudo-random generator: equal seeds
produce equal sequences of numbers.
math.sin({x}) *math.sin()*
Returns the sine of {x} (assumed to be in radians).
math.sinh({x}) *math.sinh()*
Returns the hyperbolic sine of {x}.
math.sqrt({x}) *math.sqrt()*
Returns the square root of {x}. (You can also use the expression
`x^0.5` to compute this value.)
math.tan({x}) *math.tan()*
Returns the tangent of {x} (assumed to be in radians).
math.tanh({x}) *math.tanh()*
Returns the hyperbolic tangent of {x}.
==============================================================================
5.6 Input and Output Facilities *lua-lib-io*
The I/O library provides two different styles for file manipulation. The first
one uses implicit file descriptors; that is, there are operations to set a
default input file and a default output file, and all input/output operations
are over these default files. The second style uses explicit file
descriptors.
When using implicit file descriptors, all operations are supplied by
table `io`. When using explicit file descriptors, the operation `io.open` returns
a file descriptor and then all operations are supplied as methods of the file
descriptor.
The table `io` also provides three predefined file descriptors with their usual
meanings from C: `io.stdin`, `io.stdout`, and `io.stderr`.
Unless otherwise stated, all I/O functions return `nil` on failure (plus an
error message as a second result) and some value different from `nil` on
success.
io.close([{file}]) *io.close()*
Equivalent to `file:close`. Without a {file}, closes the default
output file.
io.flush() *io.flush()*
Equivalent to `file:flush` over the default output file.
io.input([{file}]) *io.input()*
When called with a file name, it opens the named file (in text mode),
and sets its handle as the default input file. When called with a file
handle, it simply sets this file handle as the default input file.
When called without parameters, it returns the current default input
file.
In case of errors this function raises the error, instead of returning
an error code.
io.lines([{filename}]) *io.lines()*
Opens the given file name in read mode and returns an |iterator|
function that, each time it is called, returns a new line from the
file. Therefore, the construction
`for line in io.lines(filename) do` `body` `end`
will iterate over all lines of the file. When the iterator function