> It's really odd to me Lua is only used for games. It could take the same place Python has and many other things. It's a nice platform for scripting.
I’ve written quite a bit of code in Fennel [1], a Lisp language which compiles to Lua, and enjoyed thoroughly the simplicity of Lua. I implemented map, filter and reduce by hand using Lua tables and genuinely experienced joy with how Lua tables are such a unifying concept throughout the language. I even enjoyed 1-based array indexing after a short while.
(Furthermore, I have to say Lua is meant to be a Lisp, insofar as homoiconicity is the simplest language syntax, and being Lua underneath removes all the esoterica from Lisp, making the end result even simpler.)
But Lua was designed from the very beginning with the assumption it would be embedded within a systems programming language like C. Lua lacks basic functionality other, more full-featured scripting languages ship support for out of the box, e.g. Lua doesn’t even have mkdir. Also, once you survey the landscape for argument parsing in Lua, or cross-platform statically linked binary compilation in Lua, you realize the Lua ecosystem itself expects you to be using Lua as an embedded scripting language.
I was able to get really far embedding Fennel in Rust, for example [2]. Rust is miles ahead of Lua in all the areas Lua is lacking. Instead of clumsily tacking on an object system on top of Lua, write Rust structs. Or instead of using ancient libraries for cross-platform filesystem and IO handling, leverage the native Rust ecosystem (see: dirs-next, clap).
My idea was to just embed Fennel in Rust, and write almost no Rust. And while it does certainly work, I’m increasingly of the belief you should use the language best for the task. Lua is best at being an embedded scripting language, good when you want to ship an interpreter on top of a C/Rust application for instance, or when you want something fancier than TOML or INI for config.
(In this department, see also the work being done on Starlark in the Bazel ecosystem [3].)
I would agree that generally Lua has been used for games...
But NodeMCU is one of the more well known ESPxx microcontroller firmwares, Adobe Lightroom uses Lua for plugins, and just now I found this big list as well on wikipedia:
More notably for myself, my work's robotics applications are developed with Lua 4.1, so you might actually find the small embeddable language used in more places than you might expect, especially where you don't want to do the scripting level work ( business layer) in C/C++ at the same layer your low level real-time stack operates.