← Back to context

Comment by noirscape

17 hours ago

Lua's best place is as the language "on top of" another language.

ie. You have a big application that has a configurable feature and you also need that configurable feature to be super flexible since the amount of possible variations on that feature is so large that it's not worth maintaining it in the "main" language. An example could be say, an enemy AI decision script in a turn based RPG. While you can hardcore the decisions into the language itself, it doesn't make it easy to modify (especially if you want to iteratively test it, since each iteration needs a recompilation of the entire program).

That's where LUA shines - instead you just put it in a LUA file and it's dynamically loaded and interpreted when it's needed, allowing you to rapidly modify it without needing to recompile the entire game.

Python is amazing for scripts that are also software in their own right, LUA is amazing for snippets (so a layer smaller than scripts), since on that level, none of it's shortcomings are a problem. The C interop and sandbox also makes it fairly easy to set up a DSL/importable module that runs your "main" language if that's what you need as well.