Lua has eight basic types: nil, boolean, number, string, userdata, function, thread, and table. Here are a few examples. |
|
|
print("lua" .. 'lang') |
|
print("1+1 =", 1+1) print("7.0/3.0 =", 7.0/3.0) |
|
print(true and false) print(true or false) print(not true) |
|
print(true or (true and false)) |
Note that nil is false |
if nil then print('nil is not true') else print('nil is false') end |
$ lua values.lua lualang 1+1 = 2 7.0/3.0 = 2.3333333333333 false true false true nil is false |
Next example: Variables.