Programming in Lua (first edition) (2003)

(lua.org)

Comments

vascocosta 15 hours ago
For me Lua, from a minimalism point of view, feels like the Go of dynamically typed languages.

I love how you can acquire the language easily within a very short period of time (apart from some idioms, which like in other languages take more practice). I appreciate the low number of keywords and that you have only one real way to structure data, through tables. Yet, you can use meta tables to "emulate" classes as blueprints for object creation and even inheritance, if you really need OOP, or for that matter other paradigms. In a way this reminds me of JavaScript prototypes.

As an indie game dev, Love2D really clicked. Lua is awesome as a scripting language inside a host language like C/C++/Rust, because it is simple, intuitive (both for imperative or functional styles) and rather fast.

I'm even using it as my go-to scripting language for the Linux CLI instead of Python. Python, as great as it is, feels sometimes too comprehensive for small scripts. I like to script using a language I can fully keep in my "working memory", without having to refresh my memory about some constructs/idioms. That said, I use Rust as my main statically typed language, so maybe I'm just finding excuses for my love for Lua...

I also think Lua is underrated as a possible first language. Its simplicity, readability and details like using keywords for blocks (do, end, etc) IMO make it suitable for beginners.

msephton 13 hours ago
I work in Lua every day as a game developer. A GOTY in 2023 being my highest achievement so far. By and large Lua just gets out of the way, which is the most important thing for me. I have some minor issues with it, nothing huge, and I work around them with some utility functions that I've created or collected over the years.

The most recent edition of this book is from 2016. Surely time for a new edition.

diggan 16 hours ago
This the latest edition I know about being online somewhere: https://archive.org/details/pil-4th (Programming In Lua - Fourth edition, for Lua 5.3, 2016)

I'm not sure there is a fifth edition (for Lua 5.4) but the manual/reference + fourth edition seems good enough for at least my usage: https://www.lua.org/manual/5.4/manual.html

edflsafoiewq 13 hours ago
One of the lesser known parts of Lua is that it has its own pattern matching language!

https://www.lua.org/pil/20.1.html

It is not as powerful as regexp, but it's a huge step up for string munging over raw find/substr.

kh_hk 12 hours ago
Sometimes I look back with nostalgia to a past role I had and then realize the only thing I miss is Lua, and the salary.
duduzeta 14 hours ago
Learned to write code with Roberto, the founder of lua, in my graduation but only found out about that once I had already graduated.

Really good teacher.

AnonHP 17 hours ago
This is from 2003 (December, so it's about 21 years ago). Is it still relevant?
Lasher 12 hours ago
On Aardwolf (a MUD), Lua is our main scripting language and it is amazing what people who come into the game not knowing how to program have been able to create with it, way beyond anything we envisioned.

It is lightweight when not in use and integrates perfectly with the core C codebase.

If I had to pick one single thing that has had the most impact in our game over the 25 years we have been around it would be moving all of our in-game scripting to Lua.

rednafi 5 hours ago
I love Lua for the same reason I love Go.
spacechild1 12 hours ago
PSA: if you are using (modern) C++, https://github.com/ThePhD/sol2 makes embedding Lua incredibly easy and straightforward.
Thorham 13 hours ago
Lua is nice on small platforms like a Motorola 68030.
Bostonian 13 January 2025
Title should be just "Programming in Lua".