With dynamically typed languages I feel it's better to wait until you've tried to maintain the code for a while before you consider the languages effectiveness.<p>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.<p>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.<p>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.<p>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.<p>Also using named parameters as much as possible is great for maintenance.
So much lua stuff on HN the past few days, I love it.<p>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.<p>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.
One big takeaway: a 60k LOC project in Lua is doable, and it will not crumble under its own weight.<p>Surprisingly, LuaJIT is not mentioned even once. Luau is mentioned, Teal is mentioned, Fennel, not. (But Haskell is mentioned!)<p>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.
This dev seems really inexperienced and has weird uninformed takes. The "functional vibe" but it's just using boolean logic, the "reference in a table" bugs that would happen in any language but C, the ignorance of type annotations and so much time spend on problems caused by said ignorance...
It's an unexpectedly funny interview:<p>> <i>O.C.: Have you consulted about this “tables” approach with other Lua developers?</i><p>> <i>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.</i>
I am using godot, which uses gdscript, which is known to be a slow language.<p>But if your engine is already doing the heavy lifting, a slow scripting language will not matter, because it's not doing much.<p>Also gdscript is pretty nice to use, even if it's lacking tuples, unpacking and other things.
Heh:<p>> <i>...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.</i>
Interesting article, although I am confused by the section referencing 'functional vibes' as the examples given just looks like standard code.
good to see defold win. I prefer the love2D/dragonruby framework ways instead of engine now, but can’t deny defold has it all for 2D: game editor, common game structures provided modularly, deployment, no bloat. I could only wish it was the first engine I used. Life would’ve been so much better!
Roblox has 85 mln daily active users and they use a fork of Lua for most logic. Although most games are very basic, some roleplay games must have tens of thousands of LoC.
I played the demo of Craftomation 101 a while back. It was good! Had a good balance of watching emergent behavior and feeling the need to micro-manage/accelerate the process.<p>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.
I’ve recently moved to the Neovim but even though I learned Lua enough to use it I never found it ergonomic.<p>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.