by JSLegendDev on 4/17/25, 10:55 PM with 142 comments
by mabster on 4/18/25, 1:07 AM
I had to maintain a very large Lua codebase that has been active for several years. One big problem with Lua was how it will happily take more or less parameters to functions and continue to execute compared to something like Python where it is an error to pass the wrong parameters. This meant when we update a function signature we would often incorrectly update call sites, etc.
I can't remember the specifics but we had a few issues with tables being both dictionaries and lists. IIRC, if you delete a list index and there are later list indices, they will turn into dictionary keys. We had a few bugs to do with not traversing the entire array portion of a Lua table because of this.
I also implemented a few classic algorithms, e.g. bisect in Lua and you have to be very careful with 1-based indices. You also have to be very careful when interfacing between C and Lua. I prefer 0-based indices and [start, stop) style ranges for everything nowadays.
I much prefer statically typed code during maintenance. But dynamically typed languages like Python or Typescript where you can bolt on types, later if you wish, are not too bad.
Also using named parameters as much as possible is great for maintenance.
by ksymph on 4/18/25, 1:54 PM
Defold is a great engine. It has a somewhat steep learning curve (steeper than you'd expect, anyway) and its fair share of quirks, but more often than not the quirks are deliberate tradeoffs that steer you in the direction of structuring your game well. It really feels like an extension of the lua philosophy of giving you a narrow set slightly odd, but very robust and flexible tools that you build everything else out of.
I'm back to using LOVE2D for general tinkering but a few months with Defold really changed how I approach things. I've been meaning to write up a post about it. Either way though, I'd highly recommend checking out Defold to anyone interested.
by nine_k on 4/18/25, 1:09 AM
Surprisingly, LuaJIT is not mentioned even once. Luau is mentioned, Teal is mentioned, Fennel, not. (But Haskell is mentioned!)
Little is told about the general code structure, likely because it's dictated by the (C++-based) game engine with Lua bindings. It would be interesting to see an analysis of a comparably large game built with Löve, for instance.
by helsinki on 4/18/25, 12:15 AM
by tc4v on 4/18/25, 10:35 AM
by rendall on 4/18/25, 7:21 AM
> O.C.: Have you consulted about this “tables” approach with other Lua developers?
> I.T.: After that, I went back to Dmitry and asked him if my understanding of “everything is a table” was correct and, if so, why Lua was designed this way. Dmitry told me that Lua was created at the Pontifical Catholic University of Rio de Janeiro and that it was acceptable for Pontifical Catholic Universities to design programming languages this way.
by gnabgib on 4/17/25, 11:05 PM
by jokoon on 4/18/25, 10:49 AM
But if your engine is already doing the heavy lifting, a slow scripting language will not matter, because it's not doing much.
Also gdscript is pretty nice to use, even if it's lacking tuples, unpacking and other things.
by kragen on 4/18/25, 12:59 PM
> ...why Lua was designed this way. Dmitry told me that Lua was created at the Pontifical Catholic University of Rio de Janeiro and that it was acceptable for Pontifical Catholic Universities to design programming languages this way.
by ludicrousdispla on 4/18/25, 6:26 AM
by suzzer99 on 4/18/25, 5:14 PM
by rahil627 on 4/18/25, 8:27 AM
by kgeist on 4/18/25, 8:57 AM
by zharknado on 4/18/25, 3:02 AM
Graphical-only instructions were maddening, though! Especially organizing ideas by dragging them around in 2d space. I would have loved the ability to drop into written code.
by nirav72 on 4/18/25, 6:52 AM
by xlii on 4/18/25, 7:15 AM
Recently had some time to spare and moved to Fennel. It has some sharp edges but in the end I find it much easier to maintain. In fact, I think it’s good enough to replace any kind of Lua for me.
by thi2 on 4/18/25, 2:27 AM