Cross-version feature reference for the Lua programming language. Each
feature shows the version in which it was introduced, and when it was
deprecated or removed.
rilua targets Lua 5.1.1 (the version embedded in the World of Warcraft
game client). Features from later versions are documented for reference.
The baseline. All numbers are f64. Function environments via
setfenv/getfenv. Module system via module() and package.loaders.
Pattern matching (not regex). Incremental GC. Coroutines. 21 keywords.
Added global keyword for explicit global declarations, named vararg
tables, read-only for-loop variables, table.create, incremental major
GC collections, compact arrays (60% less memory for large arrays),
decimal float printing, collectgarbage("param") unified parameter API.
Enhanced utf8.offset to return final position. Restored math.frexp
and math.ldexp as standard functions (no longer behind compat flag).
Removed debug.setcstacklimit, =expr REPL shorthand,
collectgarbage("setpause"/"setstepmul").
Bitwise operators (&, |, ~, <<, >>) are language-level
features added in 5.3, not 5.2. The bit32 library (a function
library, not operators) was added in 5.2.
rawlen was added in 5.2, not 5.3.
table.move was added in 5.3, not 5.2.
coroutine.isyieldable was added in 5.3, not 5.2.
\xHH and \z string escapes were added in 5.2, not 5.1.
Empty statement (; as a statement) was added in 5.2. In 5.1,
; is only a statement separator.
math.log10 was deprecated in 5.2 (with math.log(x, 10) as
replacement), not 5.3.
Frontier pattern %f: Was already implemented in 5.1.1 source
code (lstrlib.c lines 383–393) but undocumented. 5.2 officially
documented it. The Lua 5.2 readme lists “frontier patterns” but this
refers to documentation, not new code. rilua implements %f.
__pairs metamethod: Was not removed in 5.3. It remained
functional through 5.3 (previously corrected from “removed in 5.3” to
“removed in 5.4”; see Round 3 for further correction).
__ipairs metamethod: Was deprecated (not removed) in 5.3.
The 5.3 manual says “its __ipairs metamethod has been deprecated.”
It was removed in 5.4.
=expr REPL shorthand: Was not removed in 5.3. Calculator
mode (addreturn) was added in 5.3, but =expr coexisted through
5.4 with a “for compatibility with 5.2” comment. =expr was finally
removed in 5.5.
\xHH and \z escape sequences: rilua column was ✓ but should be
✗. The rilua lexer (scan_short_string) only handles 5.1 escapes
(\a \b \f \n \r \t \v \\ \" \' \<newline> \ddd). Previous note
“rilua includes as extension” was incorrect.
table.unpack: rilua column was ✓ but should be ✗. rilua only
registers the global unpack (5.1 standard). table.unpack is a 5.2+
feature not present in the table library.
__pairs metamethod: Was never removed from PUC-Rio source or
manual index. lbaselib.c:luaB_pairs unconditionally checks __pairs
in 5.2, 5.3, 5.4, and 5.5. Corrected from “removed in 5.4” to ✓ in
all versions 5.2 through 5.5.
string.format%s and __tostring: Started in 5.2 (when
luaL_tolstring was introduced), not 5.3. The 5.1 lstrlib.c uses
luaL_checklstring (no metamethod); 5.2+ uses luaL_tolstring.
Reserved keyword count: 5.1 has 21 keywords. 5.2+ has 22 (adds
goto). Split into separate rows to avoid implying 5.2+ also has 21.
Math compat functions (atan2, cosh, sinh, tanh, pow,
frexp, ldexp, log10): Available in 5.4 behind LUA_COMPAT_MATHLIB
(via LUA_COMPAT_5_3). Marked D instead of empty.
math.frexp and math.ldexp: Restored as standard functions in
5.5 (always available, not behind any compat flag). Marked ✓ in 5.5.
global keyword: Conditionally reserved in 5.5. Unreserved by
default when LUA_COMPAT_GLOBAL is defined (which it is by default).
__eq note: Removed “5.2+ requires same type and same metamethod”
– this restriction applies to all versions including 5.1. The 5.1
source (get_compTM) already requires both operands to share the same
metamethod function.
collectgarbage("count") note: Clarified that 5.2 is the outlier
returning 2 values (kbytes + remainder). Both 5.1 and 5.3+ return a
single combined value.
table.insert/table.remove stricter checking: Changed “5.3+” to
“5.2+”. Position bounds validation via luaL_argcheck was introduced
in 5.2, not 5.3.
debug.setcstacklimit: Changed 5.5 from ✓ to empty. This function
was added in 5.4 but removed in 5.5 (not present in 5.5 dblib[]).
package.loaders: Changed 5.3 from empty to D. Available in 5.3
via LUA_COMPAT_LOADERS (under LUA_COMPAT_5_1).
module and package.seeall: Changed 5.3 from empty to D. Available
in 5.3 via LUA_COMPAT_MODULE (under LUA_COMPAT_5_1).
Version Evolution Summary (5.4): Changed “Removed __pairs/__ipairs
metamethods” to “Removed __ipairs metamethod”. The __pairs metamethod
was never removed (present unconditionally in lbaselib.c through 5.5).
Version Evolution Summary (5.4): Changed “Removed … deprecated math
functions” to “Moved … behind LUA_COMPAT_MATHLIB”. The table data
correctly shows D (not empty) for these functions in 5.4, so “Removed”
was contradictory.
xpcall(f, msgh, ...): Changed rilua column from ✓ to ✗. The rilua
implementation matches the 5.1 signature (2 args only); extra arguments
are not forwarded to f (state.top = func_pos + 1 in base.rs).
Legend: Refined D definition from “available via compatibility flags,
not recommended” to “per reference manual or available only via
compatibility flags”. In 5.1, functions like gcinfo, table.foreach,
table.foreachi, table.getn are deprecated per the reference manual
but unconditionally registered (no compat flag). The original wording
only described the later-version compat-flag pattern.
collectgarbage("incremental"): Added ✓ for 5.2. Present in opts[]
as LUA_GCINC (value 11) for switching from generational to incremental
mode. Removed in 5.3 (with experimental generational GC), re-added in 5.4.
collectgarbage("generational"): Added ✓ for 5.2. Present in opts[]
as LUA_GCGEN (value 10). Same lifecycle as "incremental".
module (section 11): Changed 5.3 from empty to D for consistency
with section 18 (which was already corrected in Round 4). Available in
5.3 via LUA_COMPAT_MODULE under LUA_COMPAT_5_1.
unpack (global): Changed 5.3 from empty to D. Available in 5.3
via LUA_COMPAT_UNPACK (under LUA_COMPAT_5_1).
loadstring: Changed 5.3 from empty to D. Available in 5.3
via LUA_COMPAT_LOADSTRING (under LUA_COMPAT_5_1).
table.maxn: Changed 5.3 from empty to D. Available in 5.3
via LUA_COMPAT_MAXN (under LUA_COMPAT_5_2).
Math compat function notes: Changed “5.4-5.5 via LUA_COMPAT_MATHLIB”
to “5.3+ via LUA_COMPAT_MATHLIB” for math.atan2, math.cosh,
math.sinh, math.tanh, math.pow, math.log10. The flag exists in
5.3 under LUA_COMPAT_5_2, same mechanism as 5.4’s LUA_COMPAT_5_3.
math.frexp/math.ldexp notes: Changed “5.4 via LUA_COMPAT_MATHLIB”
to “5.3-5.4 via LUA_COMPAT_MATHLIB”. Same compat mechanism applies in 5.3.
ipairs note: Changed “5.3+ respects metamethods” to clarify it uses
lua_geti (which respects __index), distinct from the 5.2 __ipairs
metamethod.
Added math.ult row: New in 5.3 (unsigned integer less-than). Present
unconditionally in mathlib[] in 5.3+.
5.3 version summary: Added math.ult, string.dump strip parameter,
ipairs metamethod behavioral change, and math.log10 deprecation.
__eq note: Changed “Same type and same metamethod required (all
versions)” to distinguish 5.1-5.2 behavior (requires same metamethod via
get_compTM) from 5.3+ behavior (checks each operand’s metatable
independently via luaT_gettmbyobj).
5.4 version summary: Added math.log10 to the list of deprecated math
functions behind LUA_COMPAT_MATHLIB (was omitted while the other 7
functions were listed). Added debug.setcstacklimit, multiple user values
for userdata, generic for closing value, -W CLI flag, and __eq
relaxation. Reworded “Moved … behind LUA_COMPAT_MATHLIB” to “remain
behind LUA_COMPAT_MATHLIB (under LUA_COMPAT_5_3)” since these were
already behind the flag in 5.3.
collectgarbage("setpause"/"setstepmul"): Changed 5.5 from ✓ to
empty. These options were removed in 5.5, replaced by the unified
collectgarbage("param", name [, value]) API (LUA_GCPARAM). The
opts[] array in 5.5’s lbaselib.c no longer contains "setpause"
or "setstepmul".
Added collectgarbage("param") row: New in 5.5 only. Provides
unified get/set for GC parameters: "pause", "stepmul", "stepsize",
"minormul", "majorminor", "minormajor".
Reserved keyword count for 5.5: Changed “22 reserved keywords” from
✓ to empty for 5.5. Added new “23 reserved keywords” row for 5.5.
The 5.5 llex.h enum lists 23 reserved words (including global);
LUA_COMPAT_GLOBAL (on by default) unreserves global, making the
effective count 22, but the manual lists 23.
5.5 version summary: Added restorations (math.frexp/math.ldexp),
removals (debug.setcstacklimit, =expr REPL shorthand,
collectgarbage("setpause"/"setstepmul")), and the new
collectgarbage("param") API.