Skip to content

luax

Luax Hero

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 __gc finalizers, weak tables, and the full collectgarbage() API
  • Async / await — call async Dart functions from Lua with the await keyword, or suspend in coroutines via coroutine.resumeAsync
  • Event system — bidirectional EventEmitter bridging Dart and Lua callbacks
  • Exposed parser & ASTlua_parser.dart for static analysis tooling
  • Lua 5.3 pattern matching%b and %f patterns, plus the full reference C port
  • Binary datastring.pack, string.unpack, string.packsize, and string.dump
  • Flutter Extension — companion flutter_luax package 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.git
bash
dart pub get

Quick 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!	5

Documentation

Full documentation lives at luax.naivg.top:

License

Apache-2.0 (same as the original LuaDardo), see LICENSE.

Credits

ContributorRole
arcticfox1919Original LuaDardo author
ImL1sLuaDardo Plus fork — bug fixes, web support, async, coroutines
Telosnex / jpohhhhgoto/label, performance work, parser restructure, 40+ bug fixes
NaivGCurrent maintainer

Libraries

LibraryDescription
debugA pure-Dart Lua 5.3 VM with extra feature, and improvements over upstream LuaDardo/LuaDardoPlus.
luaLuax
lua_parserA pure-Dart Lua 5.3 VM with extra feature, and improvements over upstream LuaDardo/LuaDardoPlus.