Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Lua, a Misunderstood Language (2021) (andregarzia.com)
59 points by soapdog 11 months ago | hide | past | favorite | 9 comments


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.


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.


Oh hey Lasher! Totally wasn't expecting to see you here! Aardwolf is what got me into lua programming (and to some degree programming itself), albeit via client scripting. I do dream of building a cool area with crazy mobprogs one day, but I can never come up with good ideas.


Small world! That's awesome that Aardwolf was part of what helped you get into programming. I hear you on areas, I'm far better at the core game engine than I am coming up with good ideas and story lines for areas and quests.

I don't want to cross the line into "advertising" but this thread is probably mostly done anyway so, we have a Discord now if you want to drop by and say hi without connecting to the game itself.


> 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


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


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


The best thing is you can use index 0 for storing metadata about the list :)))





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: