Lua, a Misunderstood Language (2021)

by soapdogon 3/24/2025, 5:27 PMwith 9 comments

by noriron 3/24/2025, 8:28 PM

For programs less than about 10k lines or so, Lua exists in a class of its own. It offers nearly optimal start up latency and the interpreter is fast enough that it can interpret said 10k lines about as fast as python can run hello, world. This means you can iterate by configuring your editor to save on every keystroke and in a terminal run say `ls foo.lua | entr -c lua(jit) foo.lua` and get nearly instantaneous feedback with every keystroke.

I feel so much more empowered with this workflow than anything else out there. It is like a persistent repl (though you do have to teach yourself how not to write infinite loops regularly). The setup is so much lighter weight than an lsp and is actually more responsive. Indeed, when I get feedback this frequently and quickly, I find that I have little need for more advanced features.

Eventually though, the lack of a type system does become a problem as refactoring becomes difficult. I also dislike some of the syntax. But there is a great solution to both of these problems: use Lua to write a compiler for a new language and fix those problems. That's what I did, so now I don't use Lua anymore. But without Lua, I don't think I would have gotten to where I am now.

by Lasheron 3/24/2025, 7:32 PM

This article really hit home for me. On Aardwolf MUD we replaced "mobprog" scripting with Lua based progs back in 2007/2008 and it has been the single best change we ever made in 25+ years of our game.

The experiences that area builders have been able to create goes way beyond anything we envisioned - with 40 or so LUA functions integrated into the C codebase and basic access to rooms/objects/players and NPCs from Lua they have been able to make entire sub games.

I couldn't imagine trying to build a full application with Lua, but for this use case, it is perfect.

by gowldon 3/24/2025, 8:11 PM

> There is no situation where Lua team, or LuaRocks team, can prevent you from doing what you want like the drama that has been happening inside the Elm community.

more discussion here:

https://news.ycombinator.com/item?id=22821447

https://news.ycombinator.com/item?id=38151749

by vitiralon 3/25/2025, 12:09 AM

Indeed. I'm writing a full tech stack at https://lua.civboot.org -- the language is incredible to work with.

by bigfishrunningon 3/25/2025, 2:07 AM

https://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831...

The only problem I have with lua is 1-based indexing. I know it's addressed in the article, but I'm firmly with Dijkstra on this one. The article argues that "this is how humans think", but humans are, as a rule, incredibly imprecise