First impressions with Lua
I am not a big fan of arcane languages. When possible, I like to stick to mainstream languages. Sometimes, though, our work does drive us to some strange languages. Like Visual TCL, a toolkit for the SCO Unix operating system that I used in the final year of my BE degree.
I have mostly steered away from other popular languages such as Perl and Python. I started learning Lua when doing dissector development for Wireshark—quite skeptically at first, but I am fairly impressed by it.
I don’t want this post to be long, so I’ll quickly list those bits and pieces that are rarely seen in mainstream languages
-
Arrays as tables of key/value pairs, or associative arrays
-
Multiple return values from functions
-
A generic for loop, which in combination with multiple return values from functions, leads to some pretty strange possibilities
-
Named arguments to functions using tables
-
Closures and the ability to redefine any function, allowing for convenient sandboxing