logoalt Hacker News

ianm218yesterday at 11:05 PM1 replyview on HN

Mlua works for many use cases but is a wrapper around the C code, so you need to bundle C as part of the build. So this is worse for cross compilation and makes it so you can't easily use mlua projects in wasm32-unkown-unknown. An example is that it would be hard to run a game in the browser that exposes Lua scripting with mlua.

The other reason is that because mlua is just a wrapper around the C code, it has unsafe you can't really get around. So for example Lua is used in Redis, which has this critical CVE https://github.com/redis/redis/security/advisories/GHSA-4789... that a memory safe version of Lua wouldn't have to deal with.

Mlua is still fine or even better for many other cases though!


Replies

mplanchardyesterday at 11:21 PM

The WASM thing makes sense. Do you need unknown-unknown? Seems like support exists for emscripten and wasi: https://github.com/mlua-rs/mlua/issues/366

It just seems like a lot of hassle to write a lua interpreter, although it would be nice to see a high quality one in Rust :)

Hematita was promising, but looks abandoned.

show 1 reply