This first edition was written for Lua 5.0. While still largely relevant for later versions, there are some differences.
The fourth edition targets Lua 5.3 and is available at Amazon and other bookstores.
By buying the book, you also help to support the Lua project.
|Programming in Lua|
I started writing this book in the winter of 1998. (Here, in the southern hemisphere, that means the middle of the year. And "winter" is more like a mild autumn.) At that time, Lua was still in version 3.1. Since then, Lua went through two big changes, first to version 4.0, in 2000, then to version 5.0, in 2003.
It is quite obvious that those changes had a big impact on the book. Some parts lost their raison d'être, such as the detailed explanation around the complexity of upvalues. Whole chapters were rewritten, such as those about the C API, and whole chapters were created, such as the one about coroutines.
What is not obvious, however, is the big impact that the writing of this book had on the evolution of Lua. Not by chance, some of the biggest changes in the language were in areas not yet covered by the book at the time of the change. As I worked through the book, sometimes I suddenly got stuck in a chapter. I could not figure out how to start or even how to motivate it. It is when you try to explain how to use something that you better feel how easy it is to use it (or not). So, those difficulties were strong hints that some things in Lua needed improvement. Other times I succeeded in writing a chapter, only to discover, later, that nobody could understand or agree with what I wrote. Frequently it was my fault (as I writer), but occasionally we spotted another corner of the language that deserved some improvement. (For instance, the transition from upvalues to lexical scoping was triggered by complaints over a feeble attempt, in an earlier draft of this book, to describe upvalues as a kind of lexical scoping.)
The changes of the language deferred the completion of this book; now the completion of this book will probably defer significant changes in the language. There are at least two reasons for that: First, Lua 5.0 is cleaner and more mature than earlier versions of the language (partially thanks to the book). Second, the book adds weight to the culture around the language and therefore increases its inertia. This cultural-weight increase is the first of my main goals with this book. My second main goal is to increase even more the spread of Lua.
|Copyright © 2003–2004 Roberto Ierusalimschy. All rights reserved.|