6 ms·
Programming in Lua (first edition) (2003)
- Bostonian 2y agoTitle should be just "Programming in Lua".
- tobyhinloopen 2y agoNo, it is the first edition, there are newer editions
- wiredfool 2y agoAt least not "Lua Programming in Lua"
- toastercat 2y agoLua Programming in Lua with Lua
- boxed 2y agoThe title should not start with "Lua" is the point. The logo is just placed there because of the webpage design.
- dang 2y agoWe've popped the first Lua off the title now. Thanks! (Submitted title was "Lua Programming in Lua (first edition) (2003)")
- deleted 2y ago[deleted]
- AnonHP 2y agoThis is from 2003 (December, so it's about 21 years ago). Is it still relevant?
- JBits 2y agoIt's the only edition which is provided for free. This edition uses Lua 5.0, which is very similar to 5.1 which is still very popular as it's targeted by LuaJIT. The changes between 5.1 and 5.2 seem small as well.
- diggan 2y ago> The changes between 5.1 and 5.2 seem small as well. And then after 5.1, basically every minor version (5.2, 5.3, so on) have major changes between them, from what I recall.
- anilakar 2y agoTheir defence is always that they do not follow semver. I remember some undocumented edge cases in string match patterns breaking between 5.1 and 5.2. Imagine Python changing how regexes worked between two minor releases.
- diggan 2y ago> Their defence is always that they do not follow semver. "Defence"? Seems like the correct answer and a fact, Lua doesn't do semver, so when there are major changes between 5.3 and 5.4, it's not illogical or actually breaking semver, as they don't follow it. Plenty of projects don't follow semver, and that's perfectly fine.
- rob74 2y agoOf course, there is also this (quote from the site): > If you find this online version useful, please consider buying a copy of the current edition. This helps to support the Lua project.
- davikr 2y agoYes. The differences between 5.0 and 5.1 are small and I do not recommend using newer versions, regardless.
- diggan 2y agoThis the latest edition I know about being online somewhere: https://archive.org/details/pil-4th 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 https://www.lua.org/manual/5.4/manual.html
- msephton 2y agoThe most recent edition of this book is indeed from 2016.
- vascocosta 2y agoFor 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.
- widdershins 2y agoI agree on all points, especially the idea of using Lua as a first language. It has so few features that you're really forced to focus on fundamental concepts like functions and (simple) data structures. And its flexibility to be used in an imperative or functional manner is great too. It's almost like a stripped back Javascript, and anyone who learns it will find jumping to JS easy. I guess one might argue that 1-based indexing could cause beginners to get confused when they move to another language. But maybe it's good for them to get used to the idea that things like this can be different across languages.
- sitkack 2y agoThe other great thing about Lua is the utter sparsity of the standard library, it teaches one to think for themselves instead of only taking goods off the shelf.
- deleted 2y ago[deleted]
- duduzeta 2y agoLearned 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.
- lucasoshiro 2y agoI can only imagine how good he is a teacher. Back in 2019, a group of students was organizing a week of computer science in my university (IME-USP) and they were collecting suggestions. I suggest to bring Roberto to talk something about Lua without hope that the suggestion would be accepted and that he would come. And when I checked the schedule I saw that he would present in that week. Not only that, the day before his presentation the professors of our department arranged an informal conversation with him, and I was there. Lua is probably one of software projects that I admire the most due to it has been created to solve a problem and that solves it well, without trying to be more than that. Seeing Roberto speaking about it so close was really a memorable moment.
- edflsafoiewq 2y agoOne of the lesser known parts of Lua is that it has its own pattern matching language! https://www.lua.org/pil/20.1.html 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.
- msephton 2y agoI 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.
- vascocosta 2y agoFirst off, congrats and feel free to share a link to your game here as I got interested. I totally resonate with your comment about the language not getting in your way. I use all sorts of languages for different kinds of applications for many years and only recently I started creating games. Whereas in other domains I appreciate complex languages that address necessarily complex tasks, in game development, while the game as a whole is a complex system, you often are handling simpler tasks and mostly thinking about algorithms. At least in my experience tackling these algorithms requires mostly mathematical calculations and for that, you definitely want the language to stay out of your way. In game dev no matter if you pick an imperative or functional approach, you really need to use all your brain power on your problem domain. Language complexities are often distractions that aren't super useful, since like I already said, the task at hand is mainly algorithmic in nature.
- msephton 2y agoMy game is called YOYOZO https://news.ycombinator.com/item?id=38372936 https://news.ycombinator.com/item?id=38372936 My experience is the same as you describe: I want to think about algorithms, state machine, system structure, design, the... game. Rather than the language semantics, quirks, or fancy features. 100% agree with you.
- Thorham 2y agoLua is nice on small platforms like a Motorola 68030.
- spacechild1 2y agoPSA: if you are using (modern) C++, https://github.com/ThePhD/sol2 https://github.com/ThePhD/sol2 makes embedding Lua incredibly easy and straightforward.
- kh_hk 2y agoSometimes I look back with nostalgia to a past role I had and then realize the only thing I miss is Lua, and the salary.
- Lasher 2y agoOn 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 2y agoI love Lua for the same reason I love Go.