Skip to main content

Lua 5.4 Reference — Simplified

Based on the official Lua 5.4 Reference Manual. Simplified for quick lookup. Examples included.

Table of Contents

#TopicCovers
1Types & Valuesnil, boolean, number, string, function, userdata, thread, table
2Variables, Scopes & Environmentslocal, global, _ENV, upvalues
3Operators & Expressionsarithmetic, bitwise, relational, logical, concat, precedence
4Statements & Control Flowif, for, while, repeat, goto, break, return
5Functions & Closuresdefinitions, varargs, closures, first-class functions
6Tablescreation, sequences, arrays, records, mixed tables
7Metatables & Metamethods__index, __newindex, __add, __gc, __mode, proxy tables
8Coroutinescreate, resume, yield, wrap, status
9Error Handlingpcall, xpcall, error(), assert, protected calls
10Garbage Collectionincremental, generational, finalizers, weak tables
11Standard Librarystring, table, math, os, io, debug, coroutine, utf8, package

Quick Facts

  • Lua 5.4LuaA lightweight, embeddable scripting language used as the primary scripting language in FiveM server development. released June 2020
  • Integers: 64-bit signed (default), Floats: double-precision (default)
  • One data structure: tables (associative arrays)
  • Garbage collected: incremental or generational modes
  • Embeddable: clean C API, ~30K lines of C
  • Reserved words: and break do else elseif end false for function goto if in local nil not or repeat return then true until while