Lua was created in 1993 at the Pontifical Catholic University of Rio de Janeiro (PUC-Rio) by Roberto Ierusalimschy, Luiz Henrique de Figueiredo and Waldemar Celes. It was designed to be embedded inside larger programs written in C, and that is the core reason why Lua is so popular for game scripting: the whole interpreter is small enough to drop into an engine, fast enough to run every frame, and simple enough for designers to learn.
Origins at Tecgraf
The three creators worked at Tecgraf, a computer graphics group at PUC-Rio that built software for Petrobras, Brazil's state oil company. In the 1980s and early 1990s Brazil had strict trade barriers on computer hardware and software, so buying foreign tools was difficult and building your own was normal. Tecgraf had two small in-house languages: DEL, a data-entry language, and SOL (Simple Object Language), used for configuring reports. Users kept asking for loops, functions and conditionals, so the team merged the two into one general-purpose language.
Since "sol" means "sun" in Portuguese, the new language was named Lua, "moon". It is a proper noun, not an acronym, and the community gently corrects anyone who writes "LUA".
Design and key features
Lua's designers followed a policy of "mechanisms instead of policies": provide a few powerful building blocks and let users construct the rest.
- Tables are the only data structure. Arrays, dictionaries, objects, modules and namespaces are all tables.
- Metatables let you override behaviour such as indexing, arithmetic and comparison, which is how Lua supports object-oriented and prototype-based styles.
- First-class functions and closures, plus coroutines for cooperative multitasking.
- A clean C API based on a virtual stack, making it easy to expose engine functions to scripts.
- Portability: the reference implementation is written in clean ANSI C and compiles almost anywhere.
Arrays conventionally start at index 1, a choice that suited the engineers who were Lua's first users and remains a frequent topic of friendly argument.
A short Lua example
local Enemy = {}
Enemy.__index = Enemy
function Enemy.new(name, hp)
return setmetatable({ name = name, hp = hp }, Enemy)
end
function Enemy:hit(damage)
self.hp = math.max(0, self.hp - damage)
print(self.name .. " has " .. self.hp .. " HP left")
end
local orc = Enemy.new("Orc", 30)
orc:hit(12)
Why Lua is so popular for game scripting
Game studios usually write their engines in C or C++ for performance, but they want gameplay logic in something faster to change. Lua fits that slot almost perfectly:
- Tiny footprint: the interpreter and standard libraries are a few hundred kilobytes, important on consoles and phones.
- Speed: Lua is one of the fastest interpreted scripting languages, and Mike Pall's LuaJIT (first released in 2005) adds a very fast tracing JIT compiler.
- Easy embedding: binding C functions takes a few lines.
- Safe sandboxing: you can control exactly which functions scripts can see.
- Permissive MIT license, which suits commercial games.
Grim Fandango (1998) was an early high-profile user. World of Warcraft exposes its interface add-on system through Lua, Roblox built its own Lua derivative, Luau, with gradual typing, and engines such as LÖVE, Defold and Solar2D (formerly Corona SDK) use Lua as their main language. Garry's Mod and many other titles use it for mods.
Beyond games
Lua is also used in Adobe Lightroom, where much of the application logic is written in it; Neovim, which adopted Lua for configuration and plugins; Redis, which runs Lua scripts atomically on the server; OpenResty, which embeds LuaJIT in nginx; and network tools like Wireshark and Nmap's scripting engine.
Versions timeline
| Year | Version | Notable change |
|---|---|---|
| 1993 | Lua 1.0 | Internal release at Tecgraf |
| 2003 | Lua 5.0 | Coroutines, metatables, MIT license |
| 2006 | Lua 5.1 | Module system, incremental GC; LuaJIT's base |
| 2011 | Lua 5.2 | _ENV environments, goto |
| 2015 | Lua 5.3 | Integer subtype, bitwise operators |
| 2020 | Lua 5.4 | Generational GC, to-be-closed variables |
Influence and legacy
Lua is one of very few widely used languages created outside Europe, North America or Japan, and it remains developed by a small team at PUC-Rio. Its designers received the ACM SIGPLAN Programming Languages Software Award in 2018. The reasons why Lua is so popular for game scripting, small size, speed and a clean C API, are also why it keeps turning up in editors, databases and web servers.
Frequently asked questions
What games use Lua for scripting?
Well-known examples include World of Warcraft (interface add-ons), Roblox (through its Luau dialect), Grim Fandango, Garry's Mod and many titles built on LÖVE or Defold. Some studios use Lua only internally for gameplay logic. Mod communities often encounter it first through game add-on systems.
Is LuaJIT the same as Lua?
LuaJIT is a separate implementation that is compatible with Lua 5.1 plus selected later features. It includes a tracing JIT compiler and an FFI for calling C code directly. The official PUC-Rio Lua has moved on to 5.4, so the two have diverged.
Why do Lua arrays start at 1?
Lua's early users at Petrobras were engineers rather than professional programmers, and counting from 1 felt natural to them. The convention stuck as the language grew. Tables can technically use index 0, but the standard library assumes sequences start at 1.







