Skip to content

Releases

v1.0.2

Choose a tag to compare

@davydog187 davydog187 released this 29 Jul 12:19
3f2aead

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

Choose a tag to compare

@davydog187 davydog187 released this 16 Jul 19:07
367c93a

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

Choose a tag to compare

@davydog187 davydog187 released this 15 Jul 23:32
69e13a6

What's Changed

Read more

v1.0.0-rc.3

v1.0.0-rc.3 Pre-release
Pre-release

Choose a tag to compare

@davydog187 davydog187 released this 15 Jun 18:29
3bba16d

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 test pass 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

v1.0.0-rc.2 Pre-release
Pre-release

Choose a tag to compare

@davydog187 davydog187 released this 10 Jun 20:28
32a9ef7

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) — dense 1..n integer keys route to an :array for 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). The os.clock() origin is now seeded in install/1 rather than lazily, so elapsed time measures from a stable startup point (#340).

Fixed

  • deflua/2 guarded heads registered under :when instead of their real name, making them uncallable from Lua (#344).
  • Lua.call_function/3 returns the terse Lua error value, not the terminal render (#336).
  • pcall / xpcall pass the raised value through verbatim and add the §6.1 source: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.0 final.

Full changelog: https://github.com/tv-labs/lua/blob/v1.0.0-rc.2/CHANGELOG.md

v1.0.0-rc.1

v1.0.0-rc.1 Pre-release
Pre-release

Choose a tag to compare

@davydog187 davydog187 released this 02 Jun 22:22
cc785d9

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

  • os standard library, sandboxed (#289), and utf8 library (#258).
  • debug upvalue introspection — getupvalue/setupvalue and name tracking (#285); debug.getinfo name/namewhat from the call site (#290).
  • Position captures () in patterns across find/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/repeat block exit (#286, #303); caller's open_upvalues restored after nested execution (#245); require no longer leaks upvalue cells into the caller (#244).
  • Integer divide/modulo by zero matches PUC-Lua (#292); table.unpack rejects oversized ranges (#293); gsub validates 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

v1.0.0-rc.0 Pre-release
Pre-release

Choose a tag to compare

@davydog187 davydog187 released this 26 May 23:18

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 (including string.format width/precision,
    string.pack/unpack/packsize, and the full pattern engine for
    find/match/gmatch/gsub), table, math (including math.fmod),
    debug, io stubs (sandboxed), os (sandboxed), package/require.
  • _G global table and Lua 5.3 _ENV semantics for global access.
  • Full metamethod dispatch: __index, __newindex, __call, plus the
    arithmetic, comparison (including ~= via __eq and <=/>= falling
    back through __lt), length, concat, and tostring metamethods.
  • Varargs (...), multiple returns, generic for, goto/label, break,
    protected calls (pcall, xpcall).
  • userdata support 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),
    and attempt to call/attempt to index errors name the offending
    callee/target (#228).
  • Inspect protocol support for VM values returned across the
    Lua.eval!/2 boundary 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
    filesystem require semantics that conflict with a sandboxed embedded
    VM) (#216).
  • Benchmark harness comparing against Luerl and PUC-Lua, with quick mode
    and multi-n inputs (#230) and a setup_luaport.sh helper (#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.Chunk now holds a
    compiled prototype and is reusable across Lua.eval!/2 calls.
  • 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.RuntimeException and Lua.CompilerException are now publicly
    documented; user code can pattern-match and rescue them.

Removed

  • The {module(), atom(), list()} MFA encoding form is no longer accepted
    by Lua.encode!/2. Use a function literal or a deflua callback
    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_int64 for in-range integers (#227).

Fixed

  • 64-bit integer overflow wrapping for arithmetic and bitwise ops (#177).
  • Empty/missing-key table reads now return nil per Lua 5.3 §3.4.11
    (#179, #200).
  • Long-string [[ ... ]] lexer handles embedded ] and bracket levels
    like [==[ ... ]==], including main.lua-style headers (#180).
  • Comment tokens no longer leak past the lexer in expression lists (#182).
  • Stdlib modules are pre-populated in package.loaded so require\"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_upvalue and
    set_open_upvalue (#196).
  • _ENV semantics for global variable access (#197).
  • Hex literal and string coercion in bitwise ops (#198); math.fmod
    implemented for bitwise.lua verification (#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 gsub callbacks and preserves
    capture order (#188, #190).
  • Atom values encode to strings (#158).
  • Files containing only comments load successfully.
  • Unicode characters supported in Lua scripts.
  • pairs survives mid-iteration deletion by tracking dead keys (#202).
  • Metamethod closures receive operands through varargs (#203).
  • Float division by zero yields ±math.huge instead of raising (#204);
    // and % with a float-zero divisor return inf/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 for coerces string control values per Lua 5.3 §3.3.5 (#209).
  • io is now exposed as a table of sandboxed stubs (#210).
  • ~= routes through the __eq metamethod (#212); <=/>= fall back
    through __lt per 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.RuntimeException stacks by
    default; opt back in with Lua.new(debug: true) (#221).
  • Line number attribution for the first line of a chunk (#240).
  • string.pack no longer emits compile warnings (#224).

Full changelog: https://github.com/tv-labs/lua/blob/v1.0.0-rc.0/CHANGELOG.md

v0.4.0

Choose a tag to compare

@davydog187 davydog187 released this 06 Dec 18:45
5bf2069

What's Changed

New Contributors

Full Changelog: v0.3.0...v0.4.0

v0.3.0

Choose a tag to compare

@davydog187 davydog187 released this 09 Jun 12:49

[v0.3.0] - 2025-06-09

Added

  • Guards for encoded Lua values in deflua functions
    • is_table/1
    • is_userdata/1
    • is_lua_func/1
    • is_erl_func/1
    • is_mfa/1

Fixed

  • deflua function can now specify guards when using or not using state

v0.2.1

Choose a tag to compare

@davydog187 davydog187 released this 14 May 18:33

[v0.2.1] - 2025-05-14

Added

  • Lua.encode_list!/2 and Lua.decode_list!/2 for 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