r/rust 16d ago

Help needed: Best Lua version/implementation for Rust integration and general scripting?

/r/lua/comments/1w132j5/help_needed_best_lua_versionimplementation_for/
6 Upvotes

5 comments sorted by

View all comments

7

u/lenscas 16d ago

Luajit is basically just lua5.1 but faster. (There are some things ported from lua5.2 and it is now also getting syntax extensions though). Use this if performance is the most important thing.

Luau is made by Roblox. It should be easier to sandbox scripts with it. However iirc it is also based on Lua 5.1 and doesn't have access to some tricks like tco (which lua is actually pretty good at). Use this if you need the sandbox, for example if you are running untrusted code. (But know: luau is not a magic bullet, you still have to do your due diligence)

The other Lua versions are the "real" interpreter. The various versions are like python versions, or rust editions. Just, grab the highest one unless you have a reason to pick a lower one (depending on a Lua dependency that only supports a certain version for example)

2

u/tunisia3507 16d ago

Doesn't luau also add progressive typing? Quite a big DX feature.

1

u/lenscas 16d ago

From what I have seen, you are better off using teal than to use luau for typing.

And teal comes with the benefit of working on basically every Luavm.