Live data from Hacker News

Why I chose Lua for this blog

andregarzia.com

11–20 of 159 posts

Re: Why I chose Lua for this blog

#12
post #2

Author of the blog here in case anyone has questions.

I don't have a background in web development and have a genuine question.

> 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 :)

Re: Why I chose Lua for this blog

#13
post #9
post #7

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language— easy ≠ simple

Perhaps people's tastes vary? I find Lua an easy to use language. Easy to embed into C/C++ projects for scripting purposes. Also great when you can only spare 100 kB or so for an interpreter. (Arguably that was more important in the past.)

For me it is a much easier language than, say, Erlang.

Re: Why I chose Lua for this blog

#14
post #7

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language— easy ≠ simple

I would suggest using it to add scripting functionality to your own C or C++ project. That's when it really clicked for me.

When you're doing stuff in nvim or HammerSpoon, you're dealing with someone else's interface and the decisions that they've made.

Re: Why I chose Lua for this blog

#15

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?

Sometimes people just want to have fun

Re: Why I chose Lua for this blog

#16
You could also do something like this, have Caddy webserver parse your md files through a template

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

Re: Why I chose Lua for this blog

#18
post #11

I use perl for the same reasons. The few dynamic scripts that I need I want to write and forget them for years. Odds are with perl they'll still work 20 years from now.

This. I'm still sitting on some almost core code that's written on an over enthusiastic teenagers idea of a plan.

Re: Why I chose Lua for this blog

#19
post #7

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language— easy ≠ simple

There are languages that compile to Lua. Have you investigated those? For example, you can use a TypeScript syntax and pick up free typechecking along the way: https://typescripttolua.github.io/

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

Re: Why I chose Lua for this blog

#20
post #7

I don't know man, every time I tried to learn Lua (to write nvim plugins and HammerSpoon spoons) I disliked the ergonomics of the language. I don't understand why people say it's an easy language— easy ≠ simple

It really depends. I learned Lua in order to contribute to kulala plugin for neovim and found the language nice and easy to learn.

Of course it has its warts, but given the topic, almost everything is better than a vimscript imho.

Post reply on HN