Live data from Hacker News

Why I chose Lua for this blog

andregarzia.com

101–110 of 159 posts

Re: Why I chose Lua for this blog

#101

Earlier quoted context omitted.

it's easy, but the 1 indexes and global by default suck

The 1 indexes are only a difference from what you're used to. Lua was made by mathematicians, who of course wanted to address the first element as 1, the second element as 2, etc. 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…

> The 1 indexes are only a difference from what you're used to

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.

Re: Why I chose Lua for this blog

#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.

Re: Why I chose Lua for this blog

#103
Speaking of unconventional languages for web development, there's also Wt, for people who are used to building things using C++.

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.

Re: Why I chose Lua for this blog

#104

I spend a lot of time blogging but all I use is a ~50 line Python file that converts my markdown pages to HTML, adds my template, and generates the ToC page. Then I push to GitHub Pages. I can't imagine needing more than that. Why are these blog stacks so complex?

Speaking for myself at least, after you've been blogging for a quarter century or more there are some nice features you might want like pagination of your table-of-contents, RSS feeds (do it, everyone should do it), support for redirects so that ancient links mostly work across those decades (I've kept redirects from like three or four blogging systems now), tags pages for finding lost treasures and silly things. I b…

TBH RSS feed on a blog should be table stakes.

Preferably with full content unless you're doing some Substack personal branding "subscribe to my paid newsletter" -crap.

Re: Why I chose Lua for this blog

#105
I do the same, but I use turboLua to host, because it has great signals support and I have my private web server wired up to all kinds of devices in my environment. TurboLua is one of those under-acknowledged tools that can do so much. Pretty good mustache support too.

Re: Why I chose Lua for this blog

#106
post #81
post #65

Earlier quoted context omitted.

My point here is that if someone breaks your blog, they've broken your blog. The blast radius of that should be strictly limited. 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...

But "broken your blog" could mean "shell access to your blog server" -- is there no risk of illegal activities happening on that server that put the owner at risk? Like, I don't know, drug trade or child porn or whatever?

Anecdotally, I can't remember ever hearing about someone getting in real trouble because their server got popped and someone else used it for crime.

Re: Why I chose Lua for this blog

#107

I am not sure why one would have to use an engine for this. A blog consist of mostly repetitive list of posts made from a single identical template. Any 10y old kid could just master it enough to write them in html directly. And pandoc is just installed in seconds from any package manager if one wants to use an even easier different markup language. Heck in age of microblogging and social medias most blogs aren't eve…

The reason it has an engine is because it also has an interface for me to post and admin stuff. The previous version was generated by scripts (using Racket and not Pandoc) and that made it harder for me to post from devices that were not my own main computer where the source lived. For example, I like posting from my phone.

PS: I'm the author.

Re: Why I chose Lua for this blog

#108

Lua 5.1 to 5.2 was a fairly significant breaking change; one that has forked the community to this day with luaJIT never coming on board. 5.2 to 5.3 also broke things with the introduction of integers but mostly at the level of bindings. There is also very little included in terms of standard library and while luarocks exists many significant packages go abandoned. There are breaking language changes in the upcoming…

Be aware that Lua doesn't use semver and that versions take many years to be ready. In this page:

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.

Re: Why I chose Lua for this blog

#109
post #27

https://redbean.dev/ could be just perfect fit for you

I tried it in the early days but couldn't get it to work on my mac. Also, I'm very familiar with Lua source code and LuaRocks so I chose comfort. Redbean is amazing though and I really want to take it for a spin some day.

Re: Why I chose Lua for this blog

#110
post #23
post #2

Author of the blog here in case anyone has questions.

Why not choose Hugo ( https://gohugo.io ) or Zola ( https://www.getzola.org ?. Both are pretty well-supported by communities and have tonnes of blog themes. (Hugo has a truckload and is the top-3 widely deployed SSG's)

I have used Hugo in the past. I decided against SSG (the previous Racket version was a SSG) because I wanted dynamic features such as having an admin interface that allowed me to post and edit from my phone.
Post reply on HN