Why I Chose Lua for This Blog
Posted3 months agoActive3 months ago
andregarzia.comTechstoryHigh profile
calmmixed
Debate
60/100
LuaBloggingProgramming LanguagesWeb Development
Key topics
Lua
Blogging
Programming Languages
Web Development
The author explains why they chose Lua for their blog, sparking a discussion on the pros and cons of using Lua and other programming languages for web development and blogging.
Snapshot generated from the HN discussion
Discussion Activity
Very active discussionFirst comment
38m
Peak period
87
0-12h
Avg / period
25.7
Comment distribution154 data points
Loading chart...
Based on 154 loaded comments
Key moments
- 01Story posted
Oct 2, 2025 at 12:58 PM EDT
3 months ago
Step 01 - 02First comment
Oct 2, 2025 at 1:36 PM EDT
38m after posting
Step 02 - 03Peak activity
87 comments in 0-12h
Hottest window of the conversation
Step 03 - 04Latest activity
Oct 9, 2025 at 5:41 AM EDT
3 months ago
Step 04
Generating AI Summary...
Analyzing up to 500 comments to identify key contributors and discussion patterns
ID: 45452261Type: storyLast synced: 11/20/2025, 7:50:26 PM
Want the full context?
Jump to the original sources
Read the primary article or dive into the live Hacker News thread when you're ready.
I know its definitely smaller but I just want your opinions on it and what you might think of the language and I may be a bit sorry if this comes across as a little off topic but your blog really reminded me of arturo and my attempts on creating something like hugo in arturo but the project was abandoned mid way but if I remember correctly it was just some 50 lines of code to convert from markdown to complete website or even less since arturo's battery include markdown syntax as well as well as a web server and its written in nim which I cherish too.
I am genuinely interested in your opinions about it!
https://arturo-lang.io/
I might play with it for some project in the future.
The creator is an extremely nice person and I am proud that he follows me on github. This might be the highlight of my github right now lol.
Came to learn from awesome-nim about the language and loved it from day one. There are a lot of ways of doing the same thing but maybe that's the point since its rebol inspired.
https://arturo-lang.io/documentation/in-a-nutshell/
It looks interesting.
It basically costs nothing to pre-render a static site, which then serves several orders of magnitude faster. I'm confused why anyone would do it this way in this day and age.
I know some will go 'oh well I want a web interface to create or edit posts in', nothing says you cant just implement that part dynamic and have it update static components on modification of posts.
I considered monitoring popular posts and prerendering those. Feels like code bloat for something that might not happen.
Don't get me wrong, this blog used to prerender everything. It kinda sucked to compute which pages were affected by a change in any given page as it might need to patch indexes, cross linked references, and so on. It can be done of course, or you can simply re-render everything anyway. The added friction for development and maintenance was not worth it for me.
It is my personal blog, it is not a personal branding site to show people my cool web skills or anything. If it goes down, let it go down.
Fennel is absolutelly amazing, I love it. I just didn't had the need. I like Lua the way it is. I was a student at PUC Rio for a while, I fell in love with it there and am very familiar with it.
> Your blog is your place to experiment and program how you want it
I 100% agree with your statement and people don't need to justify their hobbies. I've done really pointless things simply for lolz and because I wanted.
My question arises because I was surprised in how ... architected and (dare I say) complex the tech stack in your blog is. In my blogging days I wrote my own HTML/CSS and published it on a Internet facing server. Later, I've used CSS templates and Markdown-to-HTML to generate the static content. What is the purpose of Lua and having a database and all the other complexity for what seems like a static blog? Again, "because I wanted to experiment" or "sharpen my skills" is a totally valid answer but seeing I don't have a background in web development I am inquiring to see if there is a technical reason for doing this. Would be curious to learn what, if any, technical problem warrants such a set up :)
The stack doesn't feel as complex to me because I know it well. Familiarity doesn't make it less complex but make it comfortable. The reason for the database is that it allows me to run queries. It makes it easier for creating "recent posts" and "posts with this tag" pages.
Lua is the glue that ties it all together. Yes, HTML/CSS can be used to create a full site but writing posts in HTML gets tiresome fast when typing on a phone for example. The way it is it has an admin interface that allows me to write markdown on my phone or edit a post. It is handy.
For my own personal projects it is less about technical reasons and more about what will make me happy. What brings the joy on and less about what is the optimal solution.
Does that makes sense?
Totally valid choice to make, but in my opinion OP is missing out. OpenResty is state of the art and has a ton of great libraries embedded in it. It's "batteries included" so to speak, and the batteries are well designed. Yichun Zhang is one of the GOATs, along with Mike Pall. And Roberto, obviously.
One of these days I'll port OpenResty to use PUC Lua and this FFI.
We should bring that back! Its such a great way to play around with client- and server-side development options in an almost zero-risk environment.
If you roll your own little cgi-bin perl script behind Apache you're far from vulnerable compared to, say, a WordPress website.
You can't utterly wrap developers up in cotton wool. Ultimately, people learn strong lessons from screwing up. You can at least make sure they're doing this learning within a sandbox in which the damage is contained. Like, maybe containerising it so it has limited access to anything that could do any real damage. If somebody builds a blogging app and the worst thing that happens is that they learn the value of sanitising your input, preventing SQL injection, that spam is an unfortunate fact of life, and that you should be very careful with how you manage cookies, I would consider that a _very_ big win for that novice developer.
Because we're talking about _developers_ here.
Please correct me wrong but for a better form of sandboxing, I would recommend something like microvm and the bottlefire thing which was recently shared if that might pique your interest as I found it to be interesting and then using it with something like https://github.com/Zouuup/landrun
There is also tinykvm and other projects too which can simply take a binary and run it and I think that maybe developers should also try out all the different sandboxes and different things just for understanding as well I suppose too. To me, I really like playing with different form of sandboxes or such technologies in general.
Also do note that I am not sure if bottlefire provides sandbox/isolation by default as they mention Sandbox with Landlock seperately so I am now a bit confused if they provide sandbox by default or not as I previously thought it might have.
If they do it for money they will install something else and run it in parallel with the blog of the owner of the server. If they are good they'll be lean with resources and not get noticed for months or years. Example: I don't run ps -ef on my server very often and even if I did there are things that can be hidden from ps. It can get complicated.
Obviously don't go rolling your custom CGI scripts on a server that also hosts your personal email - but these days we are spoiled for choice in terms of isolated hosting strategies for a blog.
Heroku, Vercel, Cloudflare Workers, Fly.io, GitHub Pages, a $5/month VPS...
Practically: Ports 22, 80, and 443 open and directly accessible from 0.0.0.0/0 is extremely manageable.
1. nobody cares 2. its not that complicated to write a dynamic web page that isn't going to get pwned
What is the typical learning project these days for beginners of a programming language?
I vote for inventory apps. Books, movies, games, whatever.
In hindsight, it was a horrible way to learn. Most YouTubers probably benefited more from clickbait teaching than from actual fundamental teaching. Eventually, I was able to navigate the internet and land on an actual structured curriculum, whose lectures and courses were long and boring but taught you the fundamentals of programming.
I am picking up a similar pattern with Vibe Coding. Beginners are more excited about having a launched product wrapped with a band-aid rather than having deep knowledge.
The blog/data directory can be backed up or even using a github repository for long term raw storage.
I'm not a fan of having the same site/application for rendering as editing the blog as it tends to become too much of a big/easy target... ie: Wordpress, how much internet traffic is script bots trying WP exploits?
https://github.com/williamcotton/webpipe
My blog code:
https://github.com/williamcotton/williamcotton.com/blob/mast...
Perhaps the road block that you've run into is because you've been treating it as just a scripting language.
There's also the venerable MoonScript: https://moonscript.org/
And YueScript, a personal fave: https://yuescript.org/doc/
A whole list: https://github.com/hengestone/lua-languages
0-indexing makes sense in the context of C where the index operator is syntactic sugar for pointer arithmetic. In higher-level languages like C# and Python and others, it's pretty much just a leftover habit from C devs that we all got used to.
Global by default is a perpetual issue, agreed.
https://www.lua.org/history.html
The left handed scissors are only a difference from what you're used to.
> Lua was made by mathematicians
The default value is nil and using nil as an index on a table returns nil. Yet nil + number is not valid and results in a runtime error.
> it's pretty much just a leftover habit from C devs
It's reflective of the fact that these languages are either intended to work with C APIs or are implemented in C itself. This makes writing FFI and extensions _far_ easier than it would be otherwise.
In fact, at least for this application I've come to enjoy its practicality!
Recoil: https://beyond-all-reason.github.io/RecoilEngine
https://andregarzia.com/2021/01/lua-a-misunderstood-language...
I like 1 based indexes and the globals don't hurt me on my projects. It is like JS, it has its own bits that are different than other languages, once you learn them you see that it is mostly fine.
> I find Lua simple
The comment you've replied to is correct: "easy ≠ simple". Lua is indeed simple, but it chooses simplicity over ease-of-use. For example, even printing the contents of a table requires explicit logic.
OTOH Python, for example, prioritises ease-of-use: `l = [1, 2, 3]; print(l)` does what you'd expect. But Python only achieves this ease at the expense of simplicity: not only does the implementation of `print` need to be more complex, its output can be complex and unpredictable as well - for example, in the case where `l` refers to itself.
When you're doing stuff in nvim or HammerSpoon, you're dealing with someone else's interface and the decisions that they've made.
Of course it has its warts, but given the topic, almost everything is better than a vimscript imho.
I can't imagine needing more than that. Why are these blog stacks so complex?
Admittedly most of my blogging history has been something of a path towards simplification from hand-rolled PHP+MySQL, with custom "forum code" markup language, stuff before "blogging" was even an agreed upon term for it (and before Markdown was anywhere near as pervasive), to complex third-party beasts like Drupal, to homegrown Python (and reStructuredText), to very simple SSG tools (these days still Jekyll, but I don't like working in Ruby much, so I keep debating a switch to Lume but I don't think its Redirects plugin is yet compatible enough with GitHub Pages for my liking and I haven't tested its RSS support yet, both of which are personal hard requirements).
Preferably with full content unless you're doing some Substack personal branding "subscribe to my paid newsletter" -crap.
1. I don't want to rely on any external SaaS but my VPS. No github action to rebuild the site or anything like that.
2. I want to be able to post from multiple devices, which means that SSGs add more friction cause I'd need to make sure the source is up to date on all machines I am trying to post. It is not a hard problem, but opening an editor online and posting is much easier. The key to blogging is reducing friction.
I've been converting my Bash scripts/functions to it, with much success thus far.
JIT-compiled languages aren't generally faster in starting up, they generally are used to speed up long-lived programs that have hot sections.
It wasn't until LuaJIT that I realized that JIT didn't inherently have to be these slow lumbering beasts that take hundreds of milliseconds just to wake from their slumber.
My point still stands though. Don't just use LuaJIT thinking it will magically make things faster in all cases. If you are embedding, LuaJIT is a no-brainer. If you are using a stand-alone interpreter, measure if you care about reality.
This seems backwards. Lua is easier to embed and luajit is just as easy to install standalone and has zero downsides.
I just said that I have measured it being slower in at least some use cases.
JIT gains better when already compiled paths run repeatedly. Most long running programs embedding Lua will choose luajit for this reason.
I don't care what people use, the point is that JIT compilation isn't magic that makes everything faster. The way to know is measure.
You know what the new interesting hotness might be? Getting the LLM to write wasm (via wat, its textual analog), and running that with https://wazero.io/ , which is astonishingly fast (although still not as fast as luajit for some reason, despite being lower-level), but also gaining multiplatform without recompile in the process
But couldn’t anything you say about Lua also be said about JS? You mentioned how Lua wasn’t batteries included, so you try to limit your libraries. Couldn’t you say the same for JS? JS itself doesn’t change much, it’s the ecosystem. Couldn’t you just pick out some small and stable libraries the same way you could with Lua?
Only problem is I have language ADHD. I use way too many to pick up another like Lua.
Golang has one of the best developer experiences and there are only very very few minor nitpicks I might have of the language but the whole ecosystem on packaging software and what not is just so easy and I love golang.
Yes, I could have picked a js runtime and done the same thing. The same thing could also have been done with literally any other language.
It is less of a "Only Lua Can Do This" situation and more of a "I Like Working with Lua" situation.
https://akkartik.name/freewheeling-apps
https://git.sr.ht/~akkartik/gen_site
* to minimize dependencies. Lua < Lua + Fennel. I'm more extreme than OP in that I don't even use LuaRocks. When I need a library I copy it in, and I pick a library that won't change often so that is a reasonable approach. I try to avoid native libraries.
* for even greater stability. Fennel is pretty stable, but I use Lua 5.1 for the most part which hasn't changed since 2008 or so. I'm more extreme than OP in even avoiding later versions of Lua.
Bottomline: the reasons I like Lua have nothing to do with syntax and are much more about these operational meta characteristics of the language. If I cared more about syntax I'd be on Fennel in a heartbeat.
xsltproc was preinstalled on my machine actually, the fact I could just run it without installing anything is pretty cool
All to say I think if long term compatibility is the primary goal there are probably better languages.
Have you already discounted php or perl?
[1] https://www.lua.org/work/doc/manual.html#8
NeoVim is committing to 5.1 and leaving it at that.
I guess I'm not sure what advantage lua has in that regard: you could stick to an old version of any language, including node, which was called out as being hard to keep up with.
https://www.lua.org/versions.html
You can see that between 5.3 and 5.4 there were five years. 5.2 to 5.3 was also a five years gap.
Breaking changes are well documented and we see them years before they happen and nothing requires you to upgrade.
Most code runs on 5.1 forward.
I worked briefly professionally in Julia a couple years ago, which is 1-indexed, and I found it an easy transition, really. Many scientific computing things are 1-indexed, as Fortran was, too, among other reasons.
My own project is a rewrite / defibrilation of the 1990s LambdaMOO server (https://codeberg.org/timbran/moor/), which had its own OO programming language that was 1-indexed.
It's just not as "weird" as people think, I think it's just a generation of people grew up with C-derived languages and have grown to expect 0 as "normal" when it's really just "accident of history/popularity". I don't think it's objectionable that Lua chose 1-indexing, it is actually more "friendly" to newcomers to programming.
A shell function is enough to call pandoc, update any kind of index (date or tag based) and an rss page really. I would hardly call that an engine, it is just an helper to not forget to update indexes and feeds.
[1] loading speed was the main reason blog engines used to split posts in single pages
PS: I'm the author.
You can spin up a node server yourself and use web components and it will run fine probably just as long as the lua code will. It's also way easier today to just use web components and not any framework since LLMs can help you speed up the development.
I considered switching to Lua (actually Fennel) but luarocks can be fiddly to use across platforms (I now run everything on ARM servers) and that pretty much was the end of that. So I’m curious as to how maintainable a Lua back-end is over time.
But... For dev work on my own server? I am targeting a specific platform.
https://github.com/dbohdan/caddy-markdown-site/blob/master/C...
^^ the above combined with caddy git fs to have your md files cloned in memory and refresh every X interval is kind of magical. Git push a new md file and wait X minutes and your website updates.
https://github.com/mohammed90/caddy-git-fs
====
Or a one-file FastHTML (python web framework) solution:
https://gist.github.com/simonMoisselin/f63c52f087704c99b6a62...
It’s so cool to take the interpreter source, type make and be using it in one minute.
I used to like moonscript coffescript-like syntax, but nowadays I mostly like plain lua, though Fennel looks appealing.
I found it surprisingly good and considering how little I know on how to use HTML/CSS/JS/PHP, the usual web stack, it would have taken me months or more to learn how to build an equivalent site using the standard stack (and then have to maintain it).
Of course, if you're already familiar with web development, that's the best way I guess, but for those who aren't and don't have the necessary time to learn, there are probably alternatives using languages they're familiar with.
I think what is really meant by choosing boring technology is that it be simple, proven, reliable.
That's the key part. Minimize cognitive load, maximize peace of mind.
Some ecosystems are "boring" in the sense that developers are not excited about them, but they also maximize your blood pressure and chance of shipping defects. That's the wrong kind of boring!
A large proportion of users may very well be on mobile, but do we just not do flexible layouts in 2025?
For example, take Javascript. With a runtime like Bun, you would have the primitives to serve some HTTP and talk to SQLite right there in the core. And here's the good news, if you carefully implement only the things that you need for your project, you probably don't need NPM. You can write it all on your own, you can peek at how NPM authors solved the problems you run into, but you still can make it all your own. This would leave you with this amazing retrocompatible language with lots of mindshare to boot.
Really, you don't need that whole ecosystem if you're solving your own problems and are not required to interface with someone else's library. And no one is forcing you to use it.
Or you could take Python, and it has a few single-file web frameworks. You can go with one of them and the standard library a very long way. No one tells you you must use any of FastAPI, Jinja, Flask, Django (anyone remembering Pyramid?), SQLAlchemy...
Or you could write it in Go, SQLite module being your only external dependency. You can even pin your go.mod to a particular version of the compiler so you're not bothered with incompatible changes, or changes at all.
Or, you could whip up Perl... but yeah. CGI.pm and DBD::SQLite are not in the core. And anything else has a litany of CPAN dependencies with their quirks. No, don't whip up Perl.
All I'm saying there's nothing that makes Lua somehow inherently more suited to your philosophy than any other mainstream language. Except maybe to be different. And you're still pulling in 29 luarocks, aren't you?
I guess this is his why ;-)
(For years now I publish with Hugo/Bunny CDN ($1/month))
I from time to time wonder if I should write my own engine. Then I laugh and write a blog post.