omniLua docs

How to run Lua with omniLua — on the command line, embedded in a Rust program, or in the browser. Start here, then jump to a guide for whatever you're building.

Install

Pick the surface you need. All three run the same Lua.

command lineshell
$ cargo install omnilua-cli   # installs the `omnilua` binary
embed in RustCargo.toml
omnilua = "0.4"
browser / Nodeshell
$ npm install omnilua

Your first embed

Create a Lua state, register a Rust function, and run a script:

main.rsrust
use omnilua::Lua;

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

To run Lua snippets without installing anything, use the playground — it runs all five versions in the browser.

Guides

Each guide covers one thing you might build.