luax

A pure-Dart implementation of the Lua 5.3 virtual machine — actively maintained, performance-tuned, and feature-complete.
English | 简体中文
About
Luax is a pure-Dart Lua 5.3 virtual machine, originally derived from LuaDardo Plus (which is a LuaDardo fork), and now maintained as an independent project. But you can still use Luax as a fork of LuaDardo.
For the full documentation — guides, API reference, and the architecture deep-dive — see the Luax documentation site.
Features
- 100% Dart — no native dependencies, runs on all Dart platforms including web
- Garbage collection — incremental tri-color mark-and-sweep collector with
__gcfinalizers, weak tables, and the fullcollectgarbage()API - Async / await — call async Dart functions from Lua with the
awaitkeyword, or suspend in coroutines viacoroutine.resumeAsync - Event system — bidirectional EventEmitter bridging Dart and Lua callbacks
- Exposed parser & AST —
lua_parser.dartfor static analysis tooling - Lua 5.3 pattern matching —
%band%fpatterns, plus the full reference C port - Binary data —
string.pack,string.unpack,string.packsize, andstring.dump - Flutter Extension — companion
flutter_luaxpackage for Flutter widget bindings
See the Features guide for the full list and deeper coverage.
Installation
yaml
dependencies:
luax:
git: https://github.com/NaivG/Luax.gitbash
dart pub getQuick Start
dart
import 'package:luax/lua.dart';
void main() {
final state = LuaState.newState();
state.openLibs();
state.doString(r'''
for i = 1, 5 do
print("Hello from Luax!", i)
end
''');
}Output:
dart
Hello from Luax! 1
Hello from Luax! 2
Hello from Luax! 3
Hello from Luax! 4
Hello from Luax! 5Documentation
Full documentation lives at luax.naivg.top:
- Getting Started — installation, first program, calling Dart from Lua
- Guide — Dart↔Lua interop, async/await, event system, coroutines, GC, web, Flutter
- API Reference — auto-generated from
///dartdoc comments - Standard Library —
string,math,table,os,coroutine,utf8, and more - Migration from
lua_dardo— drop-in replacement notes
License
Apache-2.0 (same as the original LuaDardo), see LICENSE.
Credits
| Contributor | Role |
|---|---|
| arcticfox1919 | Original LuaDardo author |
| ImL1s | LuaDardo Plus fork — bug fixes, web support, async, coroutines |
| Telosnex / jpohhhh | goto/label, performance work, parser restructure, 40+ bug fixes |
| NaivG | Current maintainer |
Libraries
| Library | Description |
|---|---|
| debug | A pure-Dart Lua 5.3 VM with extra feature, and improvements over upstream LuaDardo/LuaDardoPlus. |
| lua | Luax |
| lua_parser | A pure-Dart Lua 5.3 VM with extra feature, and improvements over upstream LuaDardo/LuaDardoPlus. |