Chronic programmer brain: what Lua feels like to a Rust scrub

27 Sep 2022

It's a well-known fact that I usually use the Rust programming language as my primary language for creating programs. There have been exceptions, a common one is the website generator and build system used to power this website: ewfm and xbs, which are programmed in Ruby.

I've been using Lua a lot throughout the last couple days and I'd like to give my thoughts on the language.

Start counting at 0?

Lua starts counting at 1, not 0. This can be a big pain in the butt and reminds me of how different computers are to us that I'm used to counting from 0 when I'm working on a piece of code.

It can also be kind of more logical though. If I want to access the first element in a list, I use number 1; although this isn't a big issue for me though since again, counting from 0 is a force of habit.

The errors are descriptive

One of the features I love about any programming language is when it has descriptive errors. It's why I love Rust. Instead of getting a cryptic error, you are told exactly what you did wrong, where and even have built-in offline support on how to potentially fix it.

While Lua doesn't offer error support quite to that degree, they are descriptive enough for me to love them to death. You will never write code that works first time.

The syntax is readable

Sure, Lua doesn't have the stupidly strict whitespace requirements that Python has so code (espeically mine) won't look as beautiful, the syntax is really readable and understandable.

This is probably something that was in mind when Lua was made, I remember reading somewhere that Lua was meant for people used to Fortran or something but I'm probably remembering wrong.

All in all, I think Lua is a good scripting language. Give it a whirl sometime.

All content on this website is licensed CC BY-ND 4.0 unless otherwise stated. Copyright © abbieoverflight 2021-2024
Powered by ewfm. This website features no AI-generated content.