If you use a variable without assigning a value to it, the variable will
have the type Nil
which practically means that the variable does not exist.
Hollywood only keeps variables which have a value. If you pass an
uninitialized variable to a function or use it with an operator, it will
be automatically converted to zero or - if the function expects a string -
to an empty string ("").
If you do not need a variable any longer, you can also set it to Nil
and
it will be deleted in the next cycle of the garbage collector then.
You can also delete an element of a table by setting it to Nil
.
Be careful when checking variables against Nil
because 0=Nil
is actually True
in Hollywood. Thus, IsNil() and GetType() are
the only reliable way to find out if a variable is really Nil
. Simply checking
against Nil
will also result in True
if the variable is 0.