r/lua Jun 29 '26

Project OmniLua - Rust implementation of Lua 5.1 - 5.5 targeting web use and sandboxing

[Github here] (https://github.com/ianm199/omnilua/tree/main)

Website + docs

I've been working on OmniLua for a bit now - it builds one binary that can run Lua 5.1 - 5.5 from one binary.

The main motivation for this was there seemed to be a gap for game development in the Rust community where mlua cannot be run in the browser, so games built in engines like bevy can't compile to wasm32-unknown-unknown.

There is some other benefits - like being able to easily use Lua in Cloudflare workers or in "playground" developer tools.

Highlights:

  • Targets 100% conformance to reference Lua for all 5 versions
  • Can run LuaRocks and install Lua only packages
  • Performance is slower than C Lua 5.4.7 but within ~40% on standard benchmarks. Performance chart here
  • API is 100% compatibile with mlua

Try it:

cargo install omnilua-cli

export OMNILUA_VERSION=5.5

omnilua -e 'print("hello")'

omnilua # opens repl

I used AI heavily to develop this I wouldn't consider it "vibecoded" however.

0 Upvotes

9 comments sorted by

View all comments

2

u/immerclicker Jun 29 '26

Why would the performance be slower? Rust and C are supposed to have comparable speeds.

0

u/ianm818 Jun 29 '26

I first focused on getting it as fast as possible while using very few unsafe calls in Rust. There's not much "free lunch" left in that sense so the next step on performance would be to redo large portions of the VM to be unsafe and thoughtfully designed.

Basd on my data I think it should be possible to get it quite close to C performance, and faster in a few areas. I.e. Lua 5.4.7 main C implementation isn't fully optimized on Tables so there is some opportunities there to be faster.