Repository navigation
Releases
v1.0.2
What's Changed
- website: parse playground snippets once per run by @davydog187 in #402
- Fix unbounded recursion on cyclic tables at the eval boundary by @fedme in #407
- lexer: slice tokens from the source binary; drop per-char position maps by @davydog187 in #399
- compiler: key scope resolution by node id and dedupe upvalue descriptors by @davydog187 in #400
- vm: cut per-call and per-iteration overhead in the dispatcher by @davydog187 in #401
- runtime: memoize the default VM template; build stdlib tables one-shot by @davydog187 in #398
- compiler: stamp node ids once, at compile time by @davydog187 in #416
- compiler: peephole pass with fused and constant opcodes by @davydog187 in #403
- vm: cheaper call convention — one-allocation register files, static-arity opcodes, call_self fusion by @davydog187 in #405
- fix(pattern): honour ^ anchor in gsub and literal caret in gmatch by @smn in #406
- fix(parser): allow comments between a bare return and its terminator by @smn in #418
- release: 1.0.2 by @davydog187 in #419
- bench: cross-version benchmarks for v0.4.0, v1.0.0 and v1.0.2 by @davydog187 in #420
New Contributors
Full Changelog: v1.0.1...v1.0.2
v1.0.1
What's Changed
- lexer/parser: report non-ASCII unexpected chars as valid UTF-8 by @davydog187 in #395
Full Changelog: v1.0.0...v1.0.1
v1.0.0
What's Changed
- feat: lexer / parser in Elixir by @davydog187 in #95
- feat: add comments to the AST by @davydog187 in #96
- feat: compiler and register-based VM (Phase 0: Arithmetic operations) by @davydog187 in #98
- Phase 2: Global variables with register assignment by @davydog187 in #99
- feat(vm): Local variables by @davydog187 in #100
- feat(vm): Conditionals by @davydog187 in #101
- feat(vm): Loops by @davydog187 in #102
- feat(vm): Basic Functions by @davydog187 in #103
- feat(vm): Closures by @davydog187 in #104
- feat(vm): Upvalues by @davydog187 in #105
- feat: add AGENTS.md and CLAUDE.md by @davydog187 in #107
- feat(vm): Tables by @davydog187 in #106
- feat(vm): Native Function Calls by @davydog187 in #108
- feat(vm): Generic For, Varargs, and Multiple Returns by @davydog187 in #109
- feat(vm): String Concatenation by @davydog187 in #110
- feat(vm): value encoding/decoding by @davydog187 in #111
- feat(vm): integrate new Parser / Compiler / VM by @davydog187 in #112
- feat(vm): Source Line Tracking & Call Stack by @davydog187 in #113
- feat: Beautiful Stack Traces & Error Messages by @davydog187 in #114
- feat: Type-safe arithmetic and comparison operations by @davydog187 in #116
- feat: Protected calls with pcall and xpcall by @davydog187 in #115
- feat: String standard library by @davydog187 in #117
- feat(phase-6): Math & Table Standard Libraries by @davydog187 in #119
- feat(phase-7): Metatables & Metamethods by @davydog187 in #120
- feat(phase-7): Metatables & Metamethods by @davydog187 in #121
- feat(phase-8): Add userdata support by @davydog187 in #122
- feat(phase-8): Add require/package system by @davydog187 in #123
- test: Add ArgumentError tests for setmetatable by @davydog187 in #124
- feat(phase-9): Add Lua 5.3 test suite integration by @davydog187 in #125
- feat: Implement select() stdlib function by @davydog187 in #126
- feat: Add shebang support in lexer by @davydog187 in #127
- feat: Add _G global table by @davydog187 in #128
- Add \z escape sequence to skip whitespace in strings by @davydog187 in #129
- Implement full varargs support for Lua 5.3 by @davydog187 in #130
- feat: integrate styler by @davydog187 in #131
- Implement load function by @davydog187 in #132
- Add Lua function call syntactic sugar and improve parser robustness by @davydog187 in #133
- feat(phase-10): Polish & Remaining TODOs by @davydog187 in #134
- feat(phase-13): String pattern matching engine by @davydog187 in #135
- feat(phase-16): Complete string.format with width/precision by @davydog187 in #136
- feat(phase-11): Compiler Fundamentals by @davydog187 in #137
- feat(phase-12): Complete metamethods support by @davydog187 in #138
- feat(phase-14a): Stubs, bitwise fixes, and math return types by @davydog187 in #140
- feat(phase-15): Debug library and module registration by @davydog187 in #139
- feat(phase-17): Vararg expansion, scope fixes, and suite triage by @davydog187 in #141
- feat: benchmark against Luerl and C Lua by @davydog187 in #143
- fix: LuaJIT in CI by @davydog187 in #150
- fix: test for loops with external variables by @davydog187 in #149
- refactor: split out lua_test language tests by @davydog187 in #151
- perf: right-size register tuple allocations by @davydog187 in #153
- perf: O(N²) → O(N) upvalue collection in closure handler by @davydog187 in #154
- perf: O(1) upvalue access by storing upvalues as a tuple by @davydog187 in #155
- perf: fully tail-recursive CPS executor with line tracking off heap by @davydog187 in #156
- fix: docs variable name by @kevinschweikert in #159
- fix: encode atom to string by @kevinschweikert in #158
- chore: agent orchestration scaffolding by @davydog187 in #160
- chore: link plans to GitHub issues, add A14 for regression by @davydog187 in #175
- chore: sync main and branch off in /next-plan workflow by @davydog187 in #176
- feat(A0): 64-bit integer overflow wrapping for arithmetic and bitwise ops by @davydog187 in #177
- chore(A0): post-merge cleanup by @davydog187 in #178
- test(A1): pin missing-key table read behaviour by @davydog187 in #179
- fix(lexer): handle multi-line comments at every bracket level and main.lua-style headers by @davydog187 in #180
- chore(skill): commit scope is the subsystem, not the plan id by @davydog187 in #181
- chore(skill): front-load commit-scope rule and add pre-push check by @davydog187 in #183
- fix(parser): skip comment tokens between expression-list elements by @davydog187 in #182
- feat(stdlib): pre-populate package.loaded with installed stdlib modules by @davydog187 in #184
- fix(compiler): assign function declaration to in-scope local by @davydog187 in #185
- chore(plan): block A8 on A16 _ENV semantics by @davydog187 in #187
- fix(pattern): unblock pm.lua through line 110 by @davydog187 in #188
- fix(vm): grow register tuple when multi-return expansion overflows by @davydog187 in #189
- fix(pattern): thread VM state through gsub callbacks and fix capture order by @davydog187 in #190
- fix(stdlib): set sentinel before executing required module by @davydog187 in #191
- chore: resolve in-source TODOs by @davydog187 in #194
- chore: upgrade to elixir 1.20, OTP 29 by @davydog187 in #192
- fix(compiler): bind for-loop variable per statement to fix register reuse by @davydog187 in #195
- fix(vm): handle missing upvalue cells in get/set_open_upvalue by @davydog187 in #196
- feat(vm): implement Lua 5.3 _ENV semantics for global access by @davydog187 in #197
- fix(vm): handle Lua 5.3 hex and string coercion for bitwise ops by @davydog187 in #198
- feat(stdlib): implement math.fmod for bitwise.lua bit32 verification by @davydog187 in #199
- fix(vm): align table key semantics with Lua 5.3 §3.4.11 by @davydog187 in #200
- chore(release): refresh README and CHANGELOG for 1.0.0-rc.1 by @davydog187 in #201
- fix(vm): track dead keys so pairs survives mid-iteration deletion by @davydog187 in #202
- fix(vm): pass operands through varargs to metamethod closures by @davydog187 in #203
- fix(vm): float division by zero yields ±math.huge, not raise by @davydog187 in #204
- fix(lexer): treat vertical tab and form feed as whitespace by @davydog187 in #206
- chore(plans): refill ready pipeline with verified-live A7/A8 follow-ups by @davydog187 in #207
- fix(stdlib): table library functions honor __index, __newindex, __len by @davydog187 in #208
- fix(vm): coerce string control values in numeric for (Lua 5.3 §3.3.5) by @davydog187 in #209
- fix(stdlib): expose io as a table of sandboxed stubs by @davydog187 in #210
- fix(vm): // and % with float-zero divisor return inf/nan, not raise by @davydog187 in #211
- fix(vm): route ~= opcode through __eq metamethod by @davydog187 in #212
- fix(vm): make <= and >= fall back throug...
v1.0.0-rc.3
What's Changed
- ci(deploy): deploy deflua.com to Fly.io on merge to main by @davydog187 in #346
- chore: roadmap hygiene, settle 1.0.0 suite gate (20/29), tostring(fn) fix by @davydog187 in #353
- perf(vm): compile bitwise ops and set_list multi-return tails by @davydog187 in #347
- perf(table): O(1)-per-step hash iteration via memoized order index by @davydog187 in #349
- fix(stdlib): route cache_module_result through Table.put so required modules appear in pairs(package.loaded) by @davydog187 in #356
- perf(table): cache array border for O(1) #t on no-hole tables by @davydog187 in #350
- fix(vm): return terse error value for ArgumentError at protected-call boundary by @davydog187 in #354
- feat(vm): plumb per-call source lines through the compiled dispatcher by @davydog187 in #355
- fix(parser): report syntax errors at the real offending token by @davydog187 in #357
- test: make default
mix testpass quietly and deterministically by @davydog187 in #358 - perf(vm): size dispatcher register files from emitted bytecode by @davydog187 in #359
- perf(vm): honest max_registers — drop register slack on both VM engines by @davydog187 in #327
- perf(vm): close the fibonacci gap with Luerl — register reclaim + lazy call frames by @davydog187 in #360
- feat(bytecode): coverage guard + drop dead :set_global opcode by @davydog187 in #362
- feat(parser): expose structured parse errors (parse_structured + Error.to_map) by @davydog187 in #363
- fix(parser): blame the opener for unclosed tables and empty bracket lists by @davydog187 in #365
- fix(parser): propagate deep errors past function-call argument lists by @davydog187 in #366
- feat(vm): conformant goto/label on both engines by @davydog187 in #364
- feat(vm): add configurable :max_instructions instruction budget by @davydog187 in #320
- chore(release): 1.0.0-rc.3 by @davydog187 in #367
Full Changelog: v1.0.0-rc.2...v1.0.0-rc.3
v1.0.0-rc.2
The third release candidate for 1.0.0. Builds on rc.1 with a major table-storage performance win, two non-standard os epoch helpers, and a batch of protected-call / error-value correctness fixes that align pcall / xpcall and Lua.call_function/3 with Lua 5.3 §6.1. The public API is unchanged from rc.1.
Performance
- Split-storage tables (Erlang
:array+ map) — dense1..ninteger keys route to an:arrayfor O(1) functional read/write; other key types stay in the hash map. Table-heavy workloads improve 28–37% at n=1000 (Build −36%, Iterate/Sum −36%, Map+Reduce −37%, Sort −28%) and now beat Luerl on Build/Iterate/Map+Reduce (#328).
Added
os.time_ms()/os.time_us()— non-standard epoch helpers for sub-second precision (os.time()unchanged). Theos.clock()origin is now seeded ininstall/1rather than lazily, so elapsed time measures from a stable startup point (#340).
Fixed
deflua/2guarded heads registered under:wheninstead of their real name, making them uncallable from Lua (#344).Lua.call_function/3returns the terse Lua error value, not the terminal render (#336).pcall/xpcallpass the raised value through verbatim and add the §6.1source:line:prefix (#334).- Protected calls no longer roll back heap effects on error (#331).
Known issues
- Deep recursion remains ~25% slower than rc.0 (carried forward from rc.1; per-call depth bookkeeping). To be addressed before
1.0.0final.
Full changelog: https://github.com/tv-labs/lua/blob/v1.0.0-rc.2/CHANGELOG.md
v1.0.0-rc.1
The second release candidate for 1.0.0. It builds on rc.0 with new os and utf8 standard libraries, richer debug/error introspection, a substantial string.format and table performance pass, and a batch of correctness fixes around upvalue lifetimes and Lua 5.3 semantics. The public API is unchanged from rc.0.
⚡ Performance highlights
A focused pass on the two hottest stdlib areas and the VM dispatcher. Throughput vs. rc.0 (pre-compiled chunk, full Benchee runs on one machine; Luerl and PUC-Lua used as drift controls, ±3%):
| Workload | Change | Notes |
|---|---|---|
string.format — literal-heavy |
+143% | now ~2.7× faster than Luerl |
string.format — width-flagged |
+83% | |
String build via table.concat |
+66% | now faster than Luerl |
| OOP / method dispatch | +41% | now faster than Luerl |
table.sort (n=1000) |
+35% | |
string.format — many specifiers |
+26% |
Driven by an iolist-based string.format rewrite (#299, #317, #319, #316), plain-table sort/concat fast paths (#299, #318), expanded VM dispatcher coverage (#275, #277), and batched table construction (#321).
✨ Added
osstandard library, sandboxed (#289), andutf8library (#258).debugupvalue introspection —getupvalue/setupvalueand name tracking (#285);debug.getinfoname/namewhat from the call site (#290).- Position captures
()in patterns acrossfind/match/gmatch/gsub(#288). - Configurable maximum call depth (#283) and allocation-bomb DoS hardening (#305).
- Structured error data (#246); operand hints in arithmetic/bitwise type errors (#270).
🔧 Changed
- Rendered errors lead with source location; ANSI gated on TTY (#304).
- Broader Lua 5.3 official suite coverage; remaining skips narrowed to precise sub-ranges (#251, #282, #287, #294, #295).
- README rewrite, runnable
examples/, and@specs across the public API (#298, #300, #301).
🐛 Fixed
- Open upvalues now close at
do/if/while/for/repeatblock exit (#286, #303); caller'sopen_upvaluesrestored after nested execution (#245);requireno longer leaks upvalue cells into the caller (#244). - Integer divide/modulo by zero matches PUC-Lua (#292);
table.unpackrejects oversized ranges (#293);gsubvalidates its replacement (#291); parenthesised call/vararg adjusts to one value (#278);obj:method(...)expands multi-values (#248);require()converts dots to path separators (#242).
⚠️ Known issues
Deep recursion is ~25% slower than rc.0. The configurable call-depth limit (#283) adds per-call bookkeeping that recursion-dense workloads (e.g. naive fib(30)) pay in full; workloads doing real work per call are unaffected or faster. This is a deliberate safety/speed tradeoff for the RC and will be addressed before 1.0.0 final.
Full changelog: v1.0.0-rc.0...v1.0.0-rc.1
v1.0.0-rc.0
This is the first release candidate for 1.0.0. The library has been
rewritten on a new Elixir-native Lua 5.3 virtual machine, and the public
API is intended to be stable. Please report any regressions before final.
Added
- New Elixir-native Lua 5.3 virtual machine: lexer, parser, compiler, and
register-based executor, with no Erlang or C dependencies. - Standard library:
string(includingstring.formatwidth/precision,
string.pack/unpack/packsize, and the full pattern engine for
find/match/gmatch/gsub),table,math(includingmath.fmod),
debug,iostubs (sandboxed),os(sandboxed),package/require. _Gglobal table and Lua 5.3_ENVsemantics for global access.- Full metamethod dispatch:
__index,__newindex,__call, plus the
arithmetic, comparison (including~=via__eqand<=/>=falling
back through__lt), length, concat, andtostringmetamethods. - Varargs (
...), multiple returns, genericfor,goto/label,break,
protected calls (pcall,xpcall). userdatasupport for passing arbitrary Elixir terms across the boundary.- Beautiful Lua-style stack traces and error messages with source line
tracking. Every runtime error carries line and source info (#214, #215),
andattempt to call/attempt to indexerrors name the offending
callee/target (#228). Inspectprotocol support for VM values returned across the
Lua.eval!/2boundary via display structs for tables, closures,
userdata, and native functions (#218).- Mix tasks:
mix lua.eval,mix lua.suite,mix lua.bench(#220). - Lua 5.3 official test suite integration with per-file rationale for
suite files that are deferred as intentional non-goals (main.lua,
files.lua,attrib.lua,verybig.lua— shell-out, file I/O, and
filesystemrequiresemantics that conflict with a sandboxed embedded
VM) (#216). - Benchmark harness comparing against Luerl and PUC-Lua, with quick mode
and multi-ninputs (#230) and asetup_luaport.shhelper (#225).
Changed
- VM backend: Luerl is no longer a runtime dependency. The library now
runs on its own Elixir-native VM. Luerl is kept only as a:benchmark-env
dependency for performance comparison. - Encoded value tags now use the new VM's internal representation:
{:tref, integer()}for tables (replacing:luerl.tref()),{:udref, integer()}for userdata (replacing:luerl.usdref()),{:native_func, fun}for Elixir-defined Lua callables (replacing:luerl.erl_func()),
and{:lua_closure, _, _}for compiled Lua functions. - Parser error messages have a new format. The old Luerl-style
\"Line 1: syntax error before: ';'\"is now produced by the new parser
(e.g.\"Expected expression\"); user-visible string contents differ. - Chunks no longer require a separate "load" step —
Lua.Chunknow holds a
compiled prototype and is reusable acrossLua.eval!/2calls. - 64-bit integer arithmetic and bitwise ops wrap on overflow per Lua 5.3
§3.4.1, instead of widening to bignums (Luerl's behaviour). Lua.RuntimeExceptionandLua.CompilerExceptionare now publicly
documented; user code can pattern-match and rescue them.
Removed
- The
{module(), atom(), list()}MFA encoding form is no longer accepted
byLua.encode!/2. Use a function literal or adefluacallback
instead.
Performance
- Right-size register tuple allocations (#153).
- O(N²) → O(N) upvalue collection in the closure handler (#154).
- O(1) upvalue access by storing upvalues as a tuple (#155).
- Fully tail-recursive CPS executor with line tracking moved off the heap
(#156). - Fast-path the executor dispatch loop (#223).
- Fast-path
Numeric.to_signed_int64for in-range integers (#227).
Fixed
- 64-bit integer overflow wrapping for arithmetic and bitwise ops (#177).
- Empty/missing-key table reads now return
nilper Lua 5.3 §3.4.11
(#179, #200). - Long-string
[[ ... ]]lexer handles embedded]and bracket levels
like[==[ ... ]==], includingmain.lua-style headers (#180). - Comment tokens no longer leak past the lexer in expression lists (#182).
- Stdlib modules are pre-populated in
package.loadedsorequire\"io\"
resolves (#184); module sentinel is set before executing required
modules (#191). - For-loop variable now binds per statement, fixing register reuse (#195).
- Closure-handler crash on missing upvalue cells in
get_open_upvalueand
set_open_upvalue(#196). _ENVsemantics for global variable access (#197).- Hex literal and string coercion in bitwise ops (#198);
math.fmod
implemented forbitwise.luaverification (#199). - Function declaration assigned to in-scope local rather than shadowing
it (#185). - Multi-return expansion no longer overflows the register tuple (#189).
- Pattern engine threads VM state through
gsubcallbacks and preserves
capture order (#188, #190). - Atom values encode to strings (#158).
- Files containing only comments load successfully.
- Unicode characters supported in Lua scripts.
pairssurvives mid-iteration deletion by tracking dead keys (#202).- Metamethod closures receive operands through varargs (#203).
- Float division by zero yields ±
math.hugeinstead of raising (#204);
//and%with a float-zero divisor returninf/nan(#211). - Lexer treats vertical tab and form feed as whitespace (#206).
- Table-library functions (
insert,remove,concat, etc.) honor
__index,__newindex, and__len(#208). - Numeric
forcoerces string control values per Lua 5.3 §3.3.5 (#209). iois now exposed as a table of sandboxed stubs (#210).~=routes through the__eqmetamethod (#212);<=/>=fall back
through__ltper Lua 5.3 §3.4.4 (#213).- Parser threads position info through bare-expression and
unexpected-end errors (#222). - Internal Lua VM frames pruned from
Lua.RuntimeExceptionstacks by
default; opt back in withLua.new(debug: true)(#221). - Line number attribution for the first line of a chunk (#240).
string.packno longer emits compile warnings (#224).
Full changelog: https://github.com/tv-labs/lua/blob/v1.0.0-rc.0/CHANGELOG.md
v0.4.0
What's Changed
- Fix guard example in Lua.API docs by @kevinschweikert in #90
- Fix Elixir 1.19 type warning by @kevinschweikert in #91
- Remove duplicate elements on default sandbox list by @selenil in #93
- chore: upgrade to Luerl 1.5.1 by @davydog187 in #94
New Contributors
- @kevinschweikert made their first contribution in #90
- @selenil made their first contribution in #93
Full Changelog: v0.3.0...v0.4.0
v0.3.0
[v0.3.0] - 2025-06-09
Added
- Guards for encoded Lua values in
defluafunctionsis_table/1is_userdata/1is_lua_func/1is_erl_func/1is_mfa/1
Fixed
defluafunction can now specify guards when using or not using state
v0.2.1
[v0.2.1] - 2025-05-14
Added
Lua.encode_list!/2andLua.decode_list!/2for encoding and decoding function arguments and return values
Fixed
- Ensure that list return values are properly encoded
Full Changelog: v0.2.0...v0.2.1