Lua
The Lua programming language.
Features:
- Small, embeddable
- Dynamically, weakly typed
- Builtin coroutines
Often used as a configuration language (see Neovim).
Notes
- Programs are compiled into bytecode, which is then run by the Lua VM.
- Unlike most languages, indices start with 1.
- Variables are global by default. Use
local
to make a variable local. - Tables are used as arrays, maps, and objects.
- Standard
pairs
/ipairs
iterators are used to range over a table. - Strings are concatenated with the
..
operator. and
/or
are used as a ternary operator, e.g.return cond and 1 or 2
.- There is no
continue
, usegoto
+::label::
.
Tooling
- Language server: https://github.com/LuaLS/lua-language-server
- Type annotations: https://luals.github.io/wiki/annotations