TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What do I think about Lua after shipping a project with 60k lines of code?

218 pointsby JSLegendDevabout 1 month ago

17 comments

mabsterabout 1 month ago
With dynamically typed languages I feel it&#x27;s better to wait until you&#x27;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&#x27;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.
评论 #43728395 未加载
评论 #43726346 未加载
评论 #43724042 未加载
评论 #43728943 未加载
评论 #43729629 未加载
评论 #43728065 未加载
评论 #43726905 未加载
评论 #43731591 未加载
评论 #43725704 未加载
评论 #43728141 未加载
评论 #43723956 未加载
ksymphabout 1 month ago
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&#x27;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&#x27;m back to using LOVE2D for general tinkering but a few months with Defold really changed how I approach things. I&#x27;ve been meaning to write up a post about it. Either way though, I&#x27;d highly recommend checking out Defold to anyone interested.
nine_kabout 1 month ago
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&#x27;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.
评论 #43726417 未加载
评论 #43724399 未加载
评论 #43725638 未加载
评论 #43726159 未加载
评论 #43729663 未加载
评论 #43725989 未加载
helsinkiabout 1 month ago
Almost as many lines as my Neovim config.
评论 #43724009 未加载
评论 #43723709 未加载
tc4vabout 1 month ago
This dev seems really inexperienced and has weird uninformed takes. The &quot;functional vibe&quot; but it&#x27;s just using boolean logic, the &quot;reference in a table&quot; 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...
评论 #43727772 未加载
评论 #43727036 未加载
rendallabout 1 month ago
It&#x27;s an unexpectedly funny interview:<p>&gt; <i>O.C.: Have you consulted about this “tables” approach with other Lua developers?</i><p>&gt; <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>
gnabgibabout 1 month ago
(2024) Discussion ~at the time (321 points, 260 comments) <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40538540">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=40538540</a>
jokoonabout 1 month ago
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&#x27;s not doing much.<p>Also gdscript is pretty nice to use, even if it&#x27;s lacking tuples, unpacking and other things.
kragenabout 1 month ago
Heh:<p>&gt; <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>
评论 #43729286 未加载
ludicrousdisplaabout 1 month ago
Interesting article, although I am confused by the section referencing &#x27;functional vibes&#x27; as the examples given just looks like standard code.
评论 #43741363 未加载
suzzer99about 1 month ago
Eight space tabs. My eyes! The goggles they do nothing!
rahil627about 1 month ago
good to see defold win. I prefer the love2D&#x2F;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!
kgeistabout 1 month ago
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.
zharknadoabout 1 month ago
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&#x2F;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.
nirav72about 1 month ago
This is the second game I&#x27;ve found out recently that is written in Lua. The first one one being - Beyond All Reason.
评论 #43729164 未加载
评论 #43725765 未加载
评论 #43727894 未加载
评论 #43725817 未加载
评论 #43727630 未加载
评论 #43730628 未加载
评论 #43725867 未加载
xliiabout 1 month ago
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.
thi2about 1 month ago
Since when is LoC some kind of measurement?
评论 #43724380 未加载
评论 #43725561 未加载