There are things that aren't great about lua, and I'm not going to pretend they're not. buuuut...
- It's really perfectly ok if you use competently.
- There are large complex systems and games built using it (eg. factorio) that show that scaling it is both pragmatic and possible.
- It has a big active community.
When you compare it some other scripting solutions (boo, unityscript) that were just incompetently done, or mystifyingly deciding that writing your own language is the solution (jai, gdscript), I feel you have to admit it's a reasonably pragmatic choice.
There aren't a lot of other languages that embed as a scripting layer the same way that lua does, with the same performance.
Many candidates are either very hard to work with embedded (python) or simply lack any feasible way to possible embed them as a runtime scripting layer (go, zig, c, etc).
Maybe there's a future for WASM scripting layers in games, but for now, I certainly haven't seen it done well.
I can confidently say: Lua, the language, is not a minefield. Not to me. Not to you. Not to anyone.
Some projects expose a lua scripting API that is a minefield; ...but those two things are not the same thing, and by all accounts (I haven't used it personally, but just idly reading the forums) the defold scripting layer seems fine to most people.
I remember some years ago we got somebody joining irc.perl.org #perl to ask for help replacing perl with lua as a game scripting system.
Obviously, a few people were like "uh, why would -we- want to help you with that?"
As soon as I saw an example of this existing code, however, I told said people to STFU ... because for some arsef_cked reason I don't understand at all, they'd used EmbPerl of all things for the scripting, which is basically "PHP for mod_perl" and exactly as horrible as you might imagine even when used for its actual purpose rather than in this case for something completely unrelated.
Even if sensible perl would've been an acceptable approach (and speaking as a veteran perl programmer, I would still consider lua to be more suitable; I strongly consider an importand part of the Zen of Perl to be knowing when to use something else) the approach they had taken was an abomination unto Nuggan and very much deserved to die.
What they had was very definitely the sort of perl code that justifiably contributes to people hating perl, and I considered it a service to perl to help them rip it out in favour of lua code that actually made sense.
(I, personally, think perl works very well as a scripting layer for e.g. irssi, though you might come away disagreeing if you read the average irssi script rather than ones written with a little care and concern ... but for a game? Nah, lua all the frigging way)
Obviously any engine will have a lua scripting api written in c++ but if youre somehow casting shade about factorio being a lua success story, youre barking up the wrong tree.
> - It's really perfectly ok if you use competently.
That's the case with assembler too. It's exactly my point.
I love how lua works, is easy to embed, fast, and can compile to bytecode. But I really miss "compile time" checks, but my biggest issues are:
- You have to kind of invent your own modules / class-system. It's a lot of boilerplate and error prone
- The 1-based indexing is horrible
- Looping over 'arrays' would require sorting the keys first. i.e. there are no arrays.
It's been little over 10 years since I've done lua (gaming). Oh, and I used lua in an nginx handler after that