Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet or computer – no Kindle device required. Learn more
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera, scan the code below and download the Kindle app.
Programming In Lua Paperback – Nov. 30 2003
There is a newer edition of this item:
Programming in Lua is the official book about the language, giving a solid base for any programmer who wants to use Lua. Authored by Roberto Ierusalimschy, the chief architect of the language, it covers all aspects of Lua 5.0---from the basics to its API with C---explaining how to make good use of its features and giving numerous code examples. Programming in Lua is targeted at people with some programming background, but does not assume any prior knowledge about Lua or other scripting languages.
- Print length267 pages
- LanguageEnglish
- Publication dateNov. 30 2003
- Dimensions18.42 x 1.91 x 22.23 cm
- ISBN-108590379817
- ISBN-13978-8590379812
Customers who viewed this item also viewed
Product details
- Language : English
- Paperback : 267 pages
- ISBN-10 : 8590379817
- ISBN-13 : 978-8590379812
- Item weight : 501 g
- Dimensions : 18.42 x 1.91 x 22.23 cm
- Customer Reviews:
About the author

Roberto Ierusalimschy is the leading architect of the Lua programming language, driving its development since its inception in 1993. He is a full professor of Computer Science at PUC-Rio (the Pontifical Catholic University of Rio de Janeiro), where he works with programming-language design and implementation.
Roberto has a M.Sc. Degree and a D.Sc. Degree in Computer Science, both from PUC-Rio. He was a visiting researcher at the University of Waterloo, ICSI, GMD, and UIUC, and a Tinker Professor at Stanford. As a professor at PUC-Rio, Roberto was the advisor of several students that later became influential members of the Lua community. Roberto is also a member of the IFIP Working Group on Language Design.
Customer reviews
-
Top reviews
Top reviews from Canada
There was a problem filtering reviews right now. Please try again later.
The book begins with the basic Lua elements and structures and then advances through control structures, functions, iterators and coroutines. Iterators and coroutines are one of those language features that may confuse the first timers, but the author manages to show the concepts and inter relations between them in a way that clarified the issues even for a seasoned Lua programmer. Alas, make no mistake, the whole first part is totally worthwhile for non beginners.
The second part of the book shows one of Lua biggest assets: tables and metatables. I've seen people sneer at Lua at first glance and then convert themselves to Lua evangelists simply for the features of tables and metatables. The author does his magic and makes a whole set of apparently complex concepts flow by the reader as fluid and logical as they can be.
By the way, fluency is arguably one of the major benefits of this book. The reader is taken from substrate to substrate of the Lua way of life without even taking notice. Every end of chapter left me with the satisfaction of having been presented with one more facet of Lua and with the tranquility that everything was falling in place at the right timing.
After tables and metatables, the book presents the concepts of Packages and Object Orientation in Lua. If you had any doubt ever that Lua was able to sustain "real" Modular/OO programming, be prepared to replace your dogmas. The book not only clarifies how to do it in Lua but also shows how easy and clear the coding gets.
The author ends the second part of the book with a great chapter on Weak Tables. I have to admit that I was somewhat refractory to Weak Tables before I read this book, but after this single chapter I was converted. May the name "weak" not influence your judgment on those Weak Tables. They are great, and the book showed more about them than I was expecting.
The third part of the book focuses on the standard libraries. Those would be the Table, String, I/O, Operating System and Debug libraries. Instead of repeating the contents of the Lua reference manual, the author manages to show lots of new information about the libraries by the use of examples and clear explanations. There are some points in Lua that can indeed be quite idiosyncratic at a glance, but this book is more than enough to clarify every one of them.
The fourth and last part of the book brings us the Lua C API. For the beginner Lua programmer this part will probably be skipped, but for the average programmer and most of all for the hardcore Lua explorer, this part will be pure delight. C programming is not for the faint of heart, but having a Lua interface for your C library is akin to the jackpot of embedded languages in my opinion.
This part of the book shows that the task of wrapping C code for Lua is not only feasible, but easily done once you grasp the fundamentals. Have one thing in mind, this was no small task for the author. Describing such an plethora of resources and how to use them in six chapters demands a clear yet straight to the point approach, and once again the book shines through.
Step by step the author shows how to deal with the Stack, to get arguments from and return values back to Lua, to handle tables (even those big ones), to call Lua functions from C code, to call C functions from Lua code, to handle strings, to handle state (using the registry, references and upvalues), and last but not least to use userdata types and metatables in C.
The last chapter of the book brings two examples of the use of the C API, one offers a directory iterator and the other a really nice example of binding an existent library (expat) for Lua use. Lots of my questions on the C API were dismissed with those two examples.
I should also reserve a praise for the book index. Not only I've found it complete but it is easy to understand some details of the Lua structure only by glancing at the index pages.
Conclusion
Being one of the first readers of this book was not only a great honor but also a great surprise. As a Lua old timer, I wasn't expecting to be presented to so many novelties, subtleties and jewels of programming in almost every chapter. Was I wrong...
If you have not seen Lua until now, this book is THE starting point.
If you are acquainted with other versions of Lua but have not studied version 5.0, this book is a great shortcut for your new endeavors.
Finally, if you think Lua is your native language and no book could teach you something worthwhile, think again. I was grateful I didn't skip not even one paragraph.
We've got the language. We've got the book. Let the revolution begin... :o)
Don't waste screen space, this manual is an invaluable reference in paper format, and cheap to boot. You can also get it with free shipping at the moment and it shipped in like 2 days to me.
Must buy.
Written by the chief architect of the language, this book is aimed at programmers whishing to approach or to better understand Lua and the (often unsuspected) capabilities offered by a fully dynamic language.
Despite its deceptively small size (260 pages) and a plain, readable style with an eye-resting typesetting, "Programming in Lua" packs an impressive amount of information peppered with small, clear code examples to help digesting it; it reminds me of my favorite programming book: the K&R (Kernighan and Ritchie's "The C programming language"). It is a multi-level book that always gives something new at every reading.
Rather than offer a catalogue of functions (left to the downloadable reference manual), the book's four sections introduce capabilities, concepts and interesting techniques that may surprise programmers used to static languages.
The first section is devoted to the language itself, including not-so-common subjects like dynamic typing, multiple results, first-class functions, closures, iterators and coroutines. The following section shows how to build all sorts of data structures, from simple arrays and lists to packages and objects, using Lua's "tables" and the powerful idea of "metatables" that makes the language easily customizable.
The third section introduces the standard libraries (they are actually optional, e.g. in microcontroller applications) with special emphasis on the simple but versatile pattern matching capabilities.
The fourth and last section is different: aimed at system programmers, it explains in detail how to interface Lua and C, both to add new functions to Lua and to use Lua inside a C program (possibly called from programs written in other languages).
"Programming in Lua" covers version 5.0 of the language, which is now mature and stable. I am using Lua both as a general-purpose 'light' language for system tasks or small programs, and as an embedded language inside C++ applications: the combined power of the two languages is impressive. I liked this book a lot, I learned much from it and I've done it the honor of a place besides my well-thumbed K&R.
Top reviews from other countries
fell in love with it. This book has the makings of a classic text that you will enjoy owning. Its so refreshing to find a well written, small book on a programming language with a huge power to weight ratio. The book covers all aspects of the language and acts as tutorial, reference and language specification. As a regular user of the AWK scripting language I would have appreciated better examples on how to acheive the AWK split() function but otherwise the book provides a large range of really useful code fragments. Congratulations to the author.

