Skip to content

Instantly share code, notes, and snippets.

@truemedian
Last active February 18, 2026 14:30
Show Gist options
  • Select an option

  • Save truemedian/590ef0f318530d6457e0245062c2682d to your computer and use it in GitHub Desktop.

Select an option

Save truemedian/590ef0f318530d6457e0245062c2682d to your computer and use it in GitHub Desktop.

Lua Compatibility Matrix

🟩: This function or field is supported unconditionally in this version.
🟨: This function or field is behind a LUA_COMPAT_* define and may or may not be available.
πŸŸ₯: This function or field will not be present in this version under any condition.

Feature Lua 5.1 Lua 5.2 Lua 5.3 Lua 5.4 Lua 5.5
Base Library 🟩 🟩 🟩 🟩 🟩
assert(v, [msg]) 🟩 🟩 🟩 🟩 🟩
collectgarbage([opt, [arg]]) 🟩 🟩 🟩 🟩 🟩
dofile([file]) 🟩 🟩 🟩 🟩 🟩
error(message, [level]) 🟩 🟩 🟩 🟩 🟩
getfenv([f]) 🟩 πŸŸ₯ πŸŸ₯ πŸŸ₯ πŸŸ₯
getmetatable(object) 🟩 🟩 🟩 🟩 🟩
ipairs(t) 🟩 🟩 🟩 🟩 🟩
load(chunk, [source, [mode, [env]]])) πŸŸ₯ 🟩 🟩 🟩 🟩
load(func, [name]) 🟩 🟩 🟩 🟩 🟩
loadfile([file, [mode, [env]]]) πŸŸ₯ 🟩 🟩 🟩 🟩
loadfile([file]) 🟩 🟩 🟩 🟩 🟩
loadstring(string, [name]) 🟩 🟨1 🟨1 πŸŸ₯ πŸŸ₯
next(table, [index]) 🟩 🟩 🟩 🟩 🟩
pairs(t) 🟩 🟩 🟩 🟩 🟩
pcall(f, [...]) 🟩 🟩 🟩 🟩 🟩
print(...) 🟩 🟩 🟩 🟩 🟩
rawequal(v1, v2) 🟩 🟩 🟩 🟩 🟩
rawget(tbl, k) 🟩 🟩 🟩 🟩 🟩
rawlen(v) πŸŸ₯ 🟩 🟩 🟩 🟩
rawset(tbl, k, v) 🟩 🟩 🟩 🟩 🟩
select(index, ...) 🟩 🟩 🟩 🟩 🟩
setfenv(f, table) 🟩 πŸŸ₯ πŸŸ₯ πŸŸ₯ πŸŸ₯
setmetatable(table, metatable) 🟩 🟩 🟩 🟩 🟩
tonumber(e, [base]) 🟩 🟩 🟩 🟩 🟩
tostring(e) 🟩 🟩 🟩 🟩 🟩
type(v) 🟩 🟩 🟩 🟩 🟩
unpack(list, [i, [j]]) 🟩 🟨2 🟨2 πŸŸ₯ πŸŸ₯
warn(msg1, ...) πŸŸ₯ πŸŸ₯ πŸŸ₯ 🟩 🟩
xpcall(f, errf, [...]) πŸŸ₯ 🟩 🟩 🟩 🟩
xpcall(f, errf) 🟩 🟩 🟩 🟩 🟩
Coroutine Library 🟩 🟩 🟩 🟩 🟩
coroutine.close(co) πŸŸ₯ πŸŸ₯ πŸŸ₯ 🟩 🟩
coroutine.create(f) 🟩 🟩 🟩 🟩 🟩
coroutine.isyieldable() πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
coroutine.resume(co, [...]) 🟩 🟩 🟩 🟩 🟩
coroutine.running() 🟩 🟩 🟩 🟩 🟩
coroutine.status(co) 🟩 🟩 🟩 🟩 🟩
coroutine.wrap(f) 🟩 🟩 🟩 🟩 🟩
coroutine.yield(...) 🟩 🟩 🟩 🟩 🟩
Package Library 🟩 🟩 🟩 🟩 🟩
module(name, [...]) 🟩 🟨3 🟨3 πŸŸ₯ πŸŸ₯
require(modname) 🟩 🟩 🟩 🟩 🟩
package.config 🟩 🟩 🟩 🟩 🟩
package.cpath 🟩 🟩 🟩 🟩 🟩
package.loaded 🟩 🟩 🟩 🟩 🟩
package.loaders 🟩 🟨4 🟨4 πŸŸ₯ πŸŸ₯
package.loadlib(libname, funcname) 🟩 🟩 🟩 🟩 🟩
package.path 🟩 🟩 🟩 🟩 🟩
package.preload 🟩 🟩 🟩 🟩 🟩
package.searchers πŸŸ₯ 🟩 🟩 🟩 🟩
package.searchpath(name, path, [sep, [rep]]) πŸŸ₯ 🟩 🟩 🟩 🟩
package.seeall(module) 🟩 🟨3 🟨3 πŸŸ₯ πŸŸ₯
String Library 🟩 🟩 🟩 🟩 🟩
string.byte(s, [i, [j]]) 🟩 🟩 🟩 🟩 🟩
string.char(...) 🟩 🟩 🟩 🟩 🟩
string.dump(f) 🟩 🟩 🟩 🟩 🟩
string.dump(f, [strip]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
string.find(s, pattern, [init, [plain]]) 🟩 🟩 🟩 🟩 🟩
string.format(fmt, ...) 🟩 🟩 🟩 🟩 🟩
string.gmatch(s, pattern) 🟩 🟩 🟩 🟩 🟩
string.gsub(s, pattern, repl, [n]) 🟩 🟩 🟩 🟩 🟩
string.len(s) 🟩 🟩 🟩 🟩 🟩
string.lower(s) 🟩 🟩 🟩 🟩 🟩
string.match(s, pattern, [init]) 🟩 🟩 🟩 🟩 🟩
string.pack(fmt, ...) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
string.packsize(fmt) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
string.rep(s, n, [sep]) 🟩 🟩 🟩 🟩 🟩
string.reverse(s) 🟩 🟩 🟩 🟩 🟩
string.sub(s, i, [j]) 🟩 🟩 🟩 🟩 🟩
string.unpack(fmt, s, [pos]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
string.upper(s) 🟩 🟩 🟩 🟩 🟩
Table Library 🟩 🟩 🟩 🟩 🟩
table.concat(tbl, [sep, [i, [j]]]) 🟩 🟩 🟩 🟩 🟩
table.insert(tbl, [pos,] value) 🟩 🟩 🟩 🟩 🟩
table.pack(...) πŸŸ₯ 🟩 🟩 🟩 🟩
table.move(a1, f, e, t, [a2]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
table.maxn(tbl) 🟩 🟨5 🟨5 πŸŸ₯ πŸŸ₯
table.remove(tbl, [pos]) 🟩 🟩 🟩 🟩 🟩
table.sort(tbl, [comp]) 🟩 🟩 🟩 🟩 🟩
table.unpack(list, [i, [j]])) πŸŸ₯ 🟩 🟩 🟩 🟩
Math Library 🟩 🟩 🟩 🟩 🟩
math.abs(x) 🟩 🟩 🟩 🟩 🟩
math.acos(x) 🟩 🟩 🟩 🟩 🟩
math.asin(x) 🟩 🟩 🟩 🟩 🟩
math.atan(x) 🟩 🟩 🟩 🟩 🟩
math.atan(x, [y]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
math.atan2(y, x) 🟩 🟩 🟨6 🟨6 🟨6
math.ceil(x) 🟩 🟩 🟩 🟩 🟩
math.cos(x) 🟩 🟩 🟩 🟩 🟩
math.cosh(x) 🟩 🟩 🟨6 🟨6 🟨6
math.deg(x) 🟩 🟩 🟩 🟩 🟩
math.exp(x) 🟩 🟩 🟩 🟩 🟩
math.floor(x) 🟩 🟩 🟩 🟩 🟩
math.fmod(x, y) 🟩 🟩 🟩 🟩 🟩
math.frexp(x) 🟩 🟩 🟨6 🟨6 🟩
math.huge 🟩 🟩 🟩 🟩 🟩
math.ldexp(m, e) 🟩 🟩 🟨6 🟨6 🟩
math.log(x) 🟩 🟩 🟩 🟩 🟩
math.log(x, [base]) πŸŸ₯ 🟩 🟩 🟩 🟩
math.log10(x) 🟩 🟨7 🟨6 🟨6 🟨6
math.max(x, ...) 🟩 🟩 🟩 🟩 🟩
math.maxinteger πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
math.min(x, ...) 🟩 🟩 🟩 🟩 🟩
math.mininteger πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
math.modf(x) 🟩 🟩 🟩 🟩 🟩
math.pow(x, y) 🟩 🟩 🟨6 🟨6 🟨6
math.rad(x) 🟩 🟩 🟩 🟩 🟩
math.random([m, [n]]) 🟩 🟩 🟩 🟩 🟩
math.randomseed(x) 🟩 🟩 🟩 🟩 🟩
math.randomseed([x, [y]]) πŸŸ₯ πŸŸ₯ πŸŸ₯ 🟩 🟩
math.sin(x) 🟩 🟩 🟩 🟩 🟩
math.sinh(x) 🟩 🟩 🟨6 🟨6 🟨6
math.sqrt(x) 🟩 🟩 🟩 🟩 🟩
math.tan(x) 🟩 🟩 🟩 🟩 🟩
math.tanh(x) 🟩 🟩 🟨6 🟨6 🟨6
math.tointeger(x) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
math.type(x) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
math.ult(m, n) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
Bit Library πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.arshift(x, disp) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.band(x, ...) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.bnot(x) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.bor(x, ...) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.btest(x, ...) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.bxor(x, ...) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.extract(x, field, width) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.replace(x, v, field, width) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.lrotate(x, disp) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.lshift(x, disp) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.rrotate(x, disp) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
bit32.rshift(x, disp) πŸŸ₯ 🟩 🟨8 πŸŸ₯ πŸŸ₯
UTF8 Library πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
utf8.char(...) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
utf8.charpattern πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
utf8.codes(s) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
utf8.codepoint(s, [i, [j]]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
utf8.len(s, [i, [j]]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
utf8.offset(s, n, [i]) πŸŸ₯ πŸŸ₯ 🟩 🟩 🟩
IO Library 🟩 🟩 🟩 🟩 🟩
io.close([file]) 🟩 🟩 🟩 🟩 🟩
io.flush() 🟩 🟩 🟩 🟩 🟩
io.input([file]) 🟩 🟩 🟩 🟩 🟩
io.lines([filename]) 🟩 🟩 🟩 🟩 🟩
io.open(filename, [mode]) 🟩 🟩 🟩 🟩 🟩
io.output([file]) 🟩 🟩 🟩 🟩 🟩
io.popen(prog, [mode]) 🟩 🟩 🟩 🟩 🟩
io.read(...) 🟩 🟩 🟩 🟩 🟩
io.tmpfile() 🟩 🟩 🟩 🟩 🟩
io.type(obj) 🟩 🟩 🟩 🟩 🟩
io.write(...) 🟩 🟩 🟩 🟩 🟩
file:close() 🟩 🟩 🟩 🟩 🟩
file:flush() 🟩 🟩 🟩 🟩 🟩
file:lines() 🟩 🟩 🟩 🟩 🟩
file:read(...) 🟩 🟩 🟩 🟩 🟩
file:seek([whence], [offset]) 🟩 🟩 🟩 🟩 🟩
file:setvbuf(mode, [size]) 🟩 🟩 🟩 🟩 🟩
file:write(...) 🟩 🟩 🟩 🟩 🟩
OS Library 🟩 🟩 🟩 🟩 🟩
os.clock() 🟩 🟩 🟩 🟩 🟩
os.date([format, [time]]) 🟩 🟩 🟩 🟩 🟩
os.difftime(t2, t1) 🟩 🟩 🟩 🟩 🟩
os.execute([command]) 🟩 🟩 🟩 🟩 🟩
os.exit([code]) 🟩 🟩 🟩 🟩 🟩
os.exit([code, [close]]) πŸŸ₯ 🟩 🟩 🟩 🟩
os.getenv(varname) 🟩 🟩 🟩 🟩 🟩
os.remove(filename) 🟩 🟩 🟩 🟩 🟩
os.rename(oldname, newname) 🟩 🟩 🟩 🟩 🟩
os.setlocale([locale, [category]]) 🟩 🟩 🟩 🟩 🟩
os.time([table]) 🟩 🟩 🟩 🟩 🟩
os.tmpname() 🟩 🟩 🟩 🟩 🟩
Debug Library 🟩 🟩 🟩 🟩 🟩
debug.debug() 🟩 🟩 🟩 🟩 🟩
debug.getfenv([object]) 🟩 πŸŸ₯ πŸŸ₯ πŸŸ₯ πŸŸ₯
debug.gethook([thread]) 🟩 🟩 🟩 🟩 🟩
debug.getinfo([thread], f, [what]) 🟩 🟩 🟩 🟩 🟩
debug.getlocal([thread], f, local) 🟩 🟩 🟩 🟩 🟩
debug.getmetatable(object) 🟩 🟩 🟩 🟩 🟩
debug.getregistry() 🟩 🟩 🟩 🟩 🟩
debug.getupvalue(f, up) 🟩 🟩 🟩 🟩 🟩
debug.getuservalue(u) πŸŸ₯ 🟩 🟩 🟩 🟩
debug.getuservalue(u, [n]) πŸŸ₯ πŸŸ₯ πŸŸ₯ 🟩 🟩
debug.setfenv(object, table) 🟩 πŸŸ₯ πŸŸ₯ πŸŸ₯ πŸŸ₯
debug.sethook([thread], hook, mask, [count]) 🟩 🟩 🟩 🟩 🟩
debug.setlocal([thread], level, local, value) 🟩 🟩 🟩 🟩 🟩
debug.setmetatable(object, table) 🟩 🟩 🟩 🟩 🟩
debug.setupvalue(f, up, value) 🟩 🟩 🟩 🟩 🟩
debug.setuservalue(u, value) πŸŸ₯ 🟩 🟩 🟩 🟩
debug.setuservalue(u, value, [n]) πŸŸ₯ πŸŸ₯ πŸŸ₯ 🟩 🟩
debug.traceback([thread], [message, [level]]) 🟩 🟩 🟩 🟩 🟩
debug.upvalueid(f, n) πŸŸ₯ 🟩 🟩 🟩 🟩
debug.upvaluejoin(f1, n1, f2, n2) πŸŸ₯ 🟩 🟩 🟩 🟩

Footnotes

  1. LUA_COMPAT_LOADSTRING ↩ ↩2

  2. LUA_COMPAT_UNPACK ↩ ↩2

  3. LUA_COMPAT_MODULE ↩ ↩2 ↩3 ↩4

  4. LUA_COMPAT_LOADERS ↩ ↩2

  5. LUA_COMPAT_MAXN ↩ ↩2

  6. LUA_COMPAT_MATHLIB ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13 ↩14 ↩15 ↩16 ↩17 ↩18 ↩19 ↩20 ↩21 ↩22

  7. LUA_COMPAT_LOG10 ↩

  8. LUA_COMPAT_BITLIB ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7 ↩8 ↩9 ↩10 ↩11 ↩12 ↩13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment