Live data from Hacker News

Why I chose Lua for this blog

andregarzia.com

131–140 of 159 posts

Re: Why I chose Lua for this blog

#131
post #5

I miss the days when "implement your own blogging engine" was one of the most popular learning projects for engineers. 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.

I suppose it's because fewer people have personal web sites these days? What is the typical learning project these days for beginners of a programming language?

Maybe the ubiquitous "to do list" app?

Re: Why I chose Lua for this blog

#132
post #5

I miss the days when "implement your own blogging engine" was one of the most popular learning projects for engineers. 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.

I wrote my own DSL to write my own blogging engine with embedded Lua, jq, mustache, and more:

https://github.com/williamcotton/webpipe

My blog code:

https://github.com/williamcotton/williamcotton.com/blob/mast...

  GET /hello/:world
    |> jq: `{ world: .params.world }`
    |> handlebars: `

hello, {{world}}

` describe "hello, world" it "calls the route" when calling GET /hello/world then status is 200 and output equals `

hello, world

`

Re: Why I chose Lua for this blog

#133
>I often see wisdom in websites such as Hacker News and Lobsters around the idea of "choosing boring" because it is proven, safe, easier to maintain. I think that boring is not necessarily applicable to my case. I don't find Lua boring at all, but all that those blog posts talk about that kind of mindset are all applicable to my own choices here.

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!

Re: Why I chose Lua for this blog

#135
post #6
post #2

Author of the blog here in case anyone has questions.

Why would you build your blog to fail if some article on it ever gets popular? The fact that the most hits you ever received was 50k in a week isn't relevant; a single important post could receive that in seconds. 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.

By large I agree, its just common best practices these days. Or at least have some components statically generated like the rss feed.

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.

Re: Why I chose Lua for this blog

#136
post #77

I worked with Lua for awhile but never got over the 1-based indexing.

You'd get used to it eventually. Many of us had to go the other way. I grew up with BASIC and Wirth languages (Pascal, Modula-2, etc) that were 1-indexed and to this day even after 25, 30 years of working professionally in 0-based indexed languages I still catch myself here and there having to adjust (and whiteboard coding can sometimes throw me off under pressure), but clearly operate just fine.

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.

Re: Why I chose Lua for this blog

#137
post #102
post #98

Mine’s in Python. I took that route when it was a relatively obscure thing and PHP was gaining ground over CGI in Apache (at the time having a Python web server was downright weird) and stuck with it for a long time. These days it’s a purely static site generator and a bit too funky to release (there’s a variant over on https://github.com/rcarmo/sushy ) but I really enjoyed maintaining it while it was a small, batter…

Having run Lua on a GameBoy Advance, not that fiddly. At worst, compile it all yourself.

Targeting a specific platform is easy. Making sure your luarocks builds work across different Linux distros and architectures, not so much...

Re: Why I chose Lua for this blog

#138

Earlier quoted context omitted.

I guess it provides less freedom/flexibility on the dev side. You're forced to use LuaJIT, and you're forced to buy into OpenResty's coroutine paradigm where global variables act weird, and stuff like that. Also I bet it doesn't play super nice with LuaRocks. 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 "batterie…

While everything you said there is true, it is a matter of taste for me. I prefer working with PUC Lua over LuaJIT. The speed improvement of LuaJIT doesn't matter for me, the only thing I miss from it is the FFI. I wish PUC Lua had the same FFI interface tbh.

It does. https://github.com/q66/cffi-lua

One of these days I'll port OpenResty to use PUC Lua and this FFI.

Re: Why I chose Lua for this blog

#139

Earlier quoted context omitted.

I suppose it's because fewer people have personal web sites these days? What is the typical learning project these days for beginners of a programming language?

Maybe the ubiquitous "to do list" app?

Any simple CRUD app should do.

I vote for inventory apps. Books, movies, games, whatever.

Re: Why I chose Lua for this blog

#140
I'm curious what the rationale is for so many blogs and even some websites these days limiting their content width to this tall-skinny column of text; the OP takes about 1/5 to 1/6 of the screen width on my (4k) display.

A large proportion of users may very well be on mobile, but do we just not do flexible layouts in 2025?

Post reply on HN