Lua is a dynamically typed language. There is no defined variable type in the language. This allows each value to carry its own type.
As you have noticed, values can be stored in variables. They can be manipulated to give a value of any type. This also allows you to pass arguments to other functions and have them returned as results.
The basic types of values that you'll deal with are as follows:
nil
. Any uninitialized variable has nil
as its value. Like global variables, it is nil
by default and can be assigned nil
to delete it.false
and true
. You will notice that conditional expressions consider false
and nil
as false and anything else as true
.nil
(more information on this later in this chapter called Tables).