Skip to content

improvement: Migrate to lua 1.0#9

Merged
zachdaniel merged 1 commit into
ash-project:mainfrom
davydog187:lua-1.0-migration
Jul 18, 2026
Merged

improvement: Migrate to lua 1.0#9
zachdaniel merged 1 commit into
ash-project:mainfrom
davydog187:lua-1.0-migration

Conversation

@davydog187

Copy link
Copy Markdown
Contributor

Migrates to lua 1.0 (locked at 1.0.1), following the 1.0 migration guide. Most of the migration already landed in #5; this finishes it.

Changes

  • mix.exs: bump the requirement from ~> 1.0.0-rc to ~> 1.0.
  • Fix transaction error decoding (runtime.ex): in the RC, Lua.RuntimeException carried the VM state on its :state field and the transaction handler decoded the raised Lua value against it. In 1.0 final that field is never populated, so every error(...) / utils.transaction.rollback inside a transaction fell through to the generic lua_error envelope. The handler now decodes the exception's :value against the post-call %Lua{} it already stashes through the message channel, and strips the "<eval>:1: " location prefix 1.0 prepends to string error values.
  • Remove Luerl-era dead code, verified against the lua 1.0 source (live tags are :tref, :udref, :native_func, :lua_closure, :compiled_closure):
    • :erl_func, :erl_mfa, :funref, :usdref clauses in the result encoder and print formatter
    • the {module, function, arity} encoder clause for Luerl-decoded builtins — an MFA-shaped tuple from an action's :term slot now gets the honest {"type": "tuple"} wrap instead of an opaque function marker
    • :assert_error / :error_call error shapes in the transaction handler, which now pattern-matches %Lua.RuntimeException{} explicitly
    • the always-nil exception :state plumbing in eval.ex (the VM state lives on the wrapped :original exception)
    • stale Luerl comments in tests

Testing

  • 149/149 tests pass
  • mix format --check-formatted, mix credo --strict, and mix dialyzer all clean

Follows https://lua.hexdocs.pm/migrating-to-1-0.html.

- Bump the lua requirement from ~> 1.0.0-rc to ~> 1.0 (lock at 1.0.1)
- Fix transaction error decoding: Lua.RuntimeException no longer
  carries VM state, so decode the raised value against the post-call
  %Lua{} stashed through the message channel, and strip the location
  prefix 1.0 prepends to string error values
- Remove Luerl-era dead code: :erl_func/:erl_mfa/:funref/:usdref value
  tags, MFA-decoded builtin callables, :assert_error/:error_call error
  shapes, and the always-nil exception :state plumbing in eval

@zachdaniel zachdaniel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hell yeah.

🚀 Thank you for your contribution! 🚀

@zachdaniel
zachdaniel merged commit eea4c60 into ash-project:main Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants