typestar

Languages

Lua

A small scripting language designed for embedding, widely used in games and other host applications.

Practice Lua

27 steps across 1 tours, from the basics to complete programs.

The tours

First released
1993
Created by
Roberto Ierusalimschy, Waldemar Celes, and Luiz Henrique de Figueiredo at PUC-Rio
Typing
Dynamic and tiny; tables and metatables do everything
Snippets target
5.5
File extensions
.lua

What it is for

Lua is the language programs embed when they want to be scriptable: a complete, fast interpreter in a few hundred kilobytes of portable ANSI C, with a C API designed for exactly that handoff. World of Warcraft's entire addon ecosystem, Roblox's game scripting (via its Luau dialect), Neovim configuration, Redis server-side scripts, nginx/OpenResty request handling, and the Wireshark and VLC plugin systems all run on it — usually without their users thinking of themselves as Lua programmers.

The design is radical economy: one data structure, the table, serves as array, dictionary, record, module, and class, and metatables let a host application build whatever object model fits. Functions are first-class with real closures, coroutines provide cooperative concurrency, and the whole language reference fits in an evening. LuaJIT, Mike Pall's tracing JIT, made it for years the fastest dynamic language implementation in existence and cemented the games-industry foothold.

Its center of gravity is games and embedded scripting rather than standalone applications: the standard library is deliberately minimal (no built-in JSON, sockets, or regex beyond Lua patterns), because the host is expected to provide the batteries. That trade — tiny core, host-defined world — is exactly why it keeps getting chosen.

Where it came from

Lua was born in 1993 at PUC-Rio in Brazil, built by Roberto Ierusalimschy, Waldemar Celes, and Luiz Henrique de Figueiredo for Petrobras engineering applications that needed configurable data entry — trade restrictions on imported software made a homegrown language practical. The name means moon in Portuguese, a nod to a predecessor called SOL (sun).

Version 5.0 (2003) settled the modern language — coroutines, metatables in their current form, the register-based VM — and 5.1's package system plus the arrival of LuaJIT made the mid-2000s its breakout era: Adobe Lightroom shipped mostly in Lua, and game studios adopted it wholesale for scripting. Blizzard exposing it to World of Warcraft players created one of the largest accidental programming communities ever.

The language keeps evolving deliberately — 5.3 added integers, 5.4 generational GC — while famously breaking compatibility between versions, which is why LuaJIT stays on 5.1 and Roblox forked Luau. The team of three still steers it from Rio, making Lua one of the few widely deployed languages never run by a corporation or foundation.

What it is like to type

Lua types like structured prose: keywords instead of braces (then, do, end closing everything), almost no punctuation beyond the concatenation dots and table constructors, and local opening most lines. The 1-indexed arrays and # length operator become finger memory fast, the colon quietly passes self on method calls, and string.format carries the printf vocabulary. It is friendly, steady typing — lowercase words, few symbols — with the occasional metatable ceremony (setmetatable, __index) standing out precisely because everything else is so plain.

Practice Lua

27 steps across 1 tours, from the basics to complete programs.

Official documentation

Other languages