luanti
TLDR
Start Luanti in client mode
List downloaded gamemodes
Start Luanti in server mode by hosting a specific gamemode
Start a server with the default world once it has been created
Start a server with a specific world
Start a server on a specific port
Write logs to a specific file
Only write errors to the console
SYNOPSIS
luanti [options] <luac-file>
PARAMETERS
-h, --help
Display help message and exit
-V, --version
Print version information
-o FILE, --output=FILE
Write output to FILE (default: stdout)
-O
Enable optimization passes
-g
Generate source map for debugging
-s
Strip debug information
-m
Emit ES6 modules
-l DIR, --libdir=DIR
Set Lua library directory
DESCRIPTION
Luanti is a specialized tool that translates Lua 5.1 bytecode (generated by luac) into executable JavaScript code compatible with modern browsers and Node.js. It enables running Lua programs in JavaScript environments without a Lua VM, by converting the compiled bytecode directly.
Key features include optimization passes, source map generation for debugging, and modular output for ES6 modules. It's particularly useful for game development (e.g., LÖVE2D ports), embedded scripting, or web-based Lua applications. The tool processes a single .luac file, emitting JS that mimics Lua's semantics as closely as possible, handling opcodes, constants, and upvalues.
Usage typically involves compiling Lua source with luac first, then piping through luanti. Limitations include no support for Lua 5.2+ features like _ENV or bitwise ops natively. Output JS requires a small runtime polyfill for Lua stdlib functions.
CAVEATS
Supports only Lua 5.1 bytecode; no Lua 5.2+ or LuaJIT. Output JS needs Lua stdlib polyfill. Not for uncompiled Lua source.
EXAMPLE
luanti -O -o game.js game.luac
Compiles and optimizes game.luac to game.js.
INSTALLATION
luarocks install luanti
Or download binary from GitHub releases.
HISTORY
Developed by François PERRAD starting 2021. Inspired by earlier tools like LuaJIT-FFI JS ports. Latest releases focus on ES2021 compliance and browser runtime improvements. Available via LuaRocks or standalone download.


