Learn Lua
In 2024, I set the goal to learn the Lua programming language. Lua is a lightweight scripting language that integrates with a suprising number of applications. I specifically wanted to use Lua to better configure Neovim and begin tinkering with the Love2D game engine. As a heavy Python user, I have been pleasantly surpised with Lua’s simplicity and functional paradigm. Below are quick installation instructions and the set of resources I used to get going with Lua.
Installation
On a linux machine intalling any version of Lua, 5.4 in this case, is as simple as:
sudo apt install lua5.4
Resources
Lua First Edition
Lua First Edition is a freely available and recommended resource detailing the Lua programming language. It was published several years ago but still applies. Reading selected chapters will provide insight on Lua’s functional paradigms, collection data structure, metaprogramming, variable scope, and other key concepts.
Lua 5.4 Documentation
The Lua 5.4 documentation is the core reference for all modules in the standard library. Becoming familiar with this resource is key to learning how to effectively use Lua. I referenced this documentation throughout the learning process.
Martin Fieber’s Lua Series
I discovered this “Learning Lua” series when looking for concise instructions on how to set up a Lua project, manage a Lua environment, and test Lua code. An eight part series is promised but only the first three parts are available (project setup, creating modules, and testing). Regardless, the first three parts are insightful and well written.
Learn X in Y: Lua
This is the first resource I referenced when exploring the idea of picking up Lua. The X in Y website is full of “mini tutorials” that do a great job providing a taste of a programming language and then recommending where to go next. After going through Lua First Edition I replicated the code in the tutorial to start getting a hands on feel for Lua.
Code Wars Lua Kata
After going though the above resources I worked through a set “easy” to “medium” difficulty Katas on Code Wars to start building Lua muscle memory and observe how others worked with the language. I began to heavily reference the Lua 5.4 Documentation while doing this.
Honrable Mentions
These references, while important, where used indrectly throughout the learning process:
- Official Lua Website: the official home for Lua
- Luarocks: the Lua package management framework
- Lua User Wiki: a community driven Lua wiki