There are different data types provided by the language:
All numeric values has
number type. Internally it holds double precision floating point value. There is not special type for integer numbers, all numbers are floating point.
A boolean type which can hold either
false values. It's usually used for logic expressions and conditions checking.
String, well, is a string. A list of character.
This is a data type for storing all types of functions: usual Lua functions, anonymous Lua functions and C functions.
Lua table is a key-value map. Table is a general type for representing all sorts of complex entities: arrays, maps, objects, trees, etc.
A type representing a thread. Lua threads aren't OS threads. Multitasking in Lua is implemented with coroutines and Lua thread is a coroutine context.
This type is used for underlying C user data.
Unlike all other Lua types,
nil means only one thing: there is no value.
You can check a type of a value with a built-in Lua function called
a = 15 b = "Hello" c = 5 > 3 d = nil print(type(a)) -- number print(type(b)) -- string print(type(c)) -- boolean print(type(d)) -- nil
Since Lua has dynamic type system, you can reassign a variable with a value which has a different type:
foo = 15 print(type(foo)) -- number foo = "Now I am a string!" print(type(foo)) -- string