Luam is a modernized fork of Lua 5.1, featuring a stricter, safer, and more concise syntax. It preserves the speed and simplicity of Lua 5.1 while selectively adopting features from later Lua versions and modern programming paradigms.
Variables are local by default, preventing accidental pollution of the global namespace. There is no need to explicitly write local.
x = 10 -- Local variable
function f() -- Local function
endUse the const keyword to define immutable variables. Reassigning a const variable results in a compile-time error.
const y = 20
y = 30 -- Error: attempt to assign to const variableUse != instead of ~=.
if x != y then
-- ...
endTo simplify the language and enforce a single idiomatic style:
repeatuntillocal
have been removed.
All iterative logic is expressed using while loops.
Multiline strings use """ instead of the traditional [[ ... ]] syntax.
s = """
Multi-line
String support
"""Strings support hexadecimal escapes using \xXX.
"A" == "\x41"Tables support the __len metamethod (backported from Lua 5.2), enabling custom length semantics.
xpcall accepts arguments passed directly to the called function (backported from Lua 5.2).
xpcall(func, handler, arg1, arg2)load(chunk) handles both functions and strings, replacing the need for loadstring.
math.log(x, base)supports an optional base argument.table.pack(...)creates a table from arguments and includes annfield.table.unpack(t)is standardized (renamed fromunpack).
os.exit(boolean)supportstruefor success andfalsefor failure.package.searchersis provided as an alias forpackage.loadersfor Lua 5.2 compatibility.
Luam provides a simplified build process via a dedicated shell script.
chmod +x bld/build_lang.sh
./bld/build_lang.shBuild artifacts are placed in the bin/ directory:
bin/luam— Interactive interpreterbin/luamc— Bytecode compilerbin/sqlite3.so— SQLite3 module
Manual pages are provided in the doc/ directory:
doc/lua.1doc/luac.1
Luam is free software, released under the MIT License, matching Lua 5.1.