Boolean and Nil

Variables can be assigned the boolean values, true or false. Boolean arithmetic can be performed on boolean values using not, and and or.

When variables are not assigned any value, they are equal to nil. Lua often complains about a nil value when you tries to use a variable that has not yet been defined or initialised.

bool_variable = true and false or true and not false
print(uninitialised_variable == nil) -- prints true, all vars start as nil
print(nil == 0 or nil == "") -- prints false, nil is not the same as 0 or an empty string