omniLua

Lua 5.1–5.5,
written in Rust.

omniLua is a Lua interpreter written in Rust. It runs Lua 5.1 through 5.5 on the command line, embedded in your code, or in the browser. No C dependency.

$ cargo install omnilua-cli

It passes the official PUC-Rio test suite and runs the stock LuaRocks client.

$ omnilua -e 'print(6 * 7)'
  42

Try it — one snippet, five Luas

edit the code and run it live on every version; the output diverges
snippet.lua ⌘ / Ctrl + Enter

live — your code on each version's backend ref — reference output, shown until the runtime loads

Why omniLua

omniLua is written in Rust, so the same build runs natively and compiles to WebAssembly. mlua and rlua are C-backed and can't run in the browser. That, plus five Lua versions from one build and a sandbox for untrusted scripts, is the reason to pick it.

omniLuamlua
Pure Rust, no Cyesno
Runs in the browser (wasm)yesno
Lua versions5.1–5.5one per build
Sandbox for untrusted scriptsyesLuau only
LuaJIT speednoyes

Use mlua if you need LuaJIT speed or a mature C binding. Use omniLua for the browser, multiple versions, or a sandbox.

What you can build

i.

Game scripting

embed in your engine

Script your game in Lua and keep that scripting when the game ships to the browser. The repo has a Bevy example that drives an entity from Lua each frame and builds to wasm.

# omnilua = "0.4"
ii.

Untrusted scripts

mods, plugins, user code

Run user-supplied scripts in a sandbox with hard CPU and memory limits and the standard library removed. The limits can't be caught from Lua and refill per run.

Lua::sandboxed(..)
iii.

Lua everywhere

CLI · Rust · browser · Node

One build runs as a command-line interpreter, an embedded Rust library, and an npm package for the browser or Node. All five Lua versions come from the same core.

$ npm install omnilua

Proof

Official test suite5.4 passes the full upstream PUC-Rio suite, run unmodified by ./harness/run_official_all.sh.
LuaRocksRuns the stock LuaRocks 3.11.1 client and installs pure-Lua rocks such as inspect, dkjson, and argparse.
Memory safetyNo unsafe outside the garbage collector, the dynamic-library loader, and the wasm ABI.
Each version is tested against real Lua
VersionTested against
5.4The full official PUC-Rio suite
5.3 / 5.5Their own upstream test suites
5.1 / 5.2The reference lua binary

This is Lua source compatibility, not C API/ABI compatibility. 5.1 and 5.2 have no integer type, and math.random uses a Rust PRNG, so its sequence differs from C.

Performance

Competitive with reference C, tracked per commit. It's an interpreter, not a JIT.

1.37×
wall-time geomean
vs reference C
0.42×
fastest workload
2.4× faster than C
~0%
safety cost
bounds checks + guards

Get omniLua

Rust CLI
$ cargo install omnilua-cli
Embed in Rust
# Cargo.toml
omnilua = "0.4"
Browser / Node
$ npm install omnilua
embedding — shaped after mlua
use omnilua::Lua;

let lua = Lua::new();
let f = lua.create_function(|_, name: String| Ok(format!("hello, {name}")))?;
lua.globals().set("greet", f)?;
lua.load(r#"print(greet("omniLua"))"#).exec()?;
// → hello, omniLua

Full API on docs.rs · the browser/Node package wrapper, with a runnable example, on npm.