Lua is a small, fast, embeddable scripting language. It caters to no particular paradigm, but has simple mechanisms that allow easy implementation of all paradigms. Closures and functions as first-class types serve the functional style, while tables, Lua's swiss-army-knife of data structures, can double up as classes or objects. Co-routines allow turning the program flow inside-out, and an incremental garbage collector keeps the memory requirements low for us. Without further ado, everybody's favorite first program in Lua is:
print("Hello, World")
This is as unsurprising as most of the languages. Lua has only a few types:
Type |
Examples |
Description |
---|---|---|
nil |
nil |
This is a dummy for anything undefined. |
boolean |
true, false |
Your basic standard boolean values. |
number |
0, 1, -42, 3.14159 |
Any number double precision floating point can do. |
string |
"", 'Hi there', [[\0 multi-line strings]] |
Strings can contain escape sequences... |