or
Sign in to turn on 1-Click ordering
Sell Us Your Item
For a $4.47 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.
Sorry, this item is not available in
Image not available for
Color:
Image not available

To view this video download Flash Player

 

Programming in Lua, Second Edition [Paperback]

Roberto Ierusalimschy
4.7 out of 5 stars  See all reviews (41 customer reviews)

Buy New
$25.01 & FREE Shipping. Details
Rent
$22.98
Only 1 left in stock (more on the way).
Ships from and sold by Amazon.com. Gift-wrap available.
In Stock.
Rented by RentU and Fulfilled by Amazon.
Want it tomorrow, May 23? Choose One-Day Shipping at checkout. Details
Free Two-Day Shipping for College Students with Amazon Student

Formats

Amazon Price New from Used from
Paperback $25.01  
Shop the new tech.book(store)
New! Introducing the tech.book(store), a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now
There is a newer edition of this item:
Programming in Lua, Third Edition Programming in Lua, Third Edition 5.0 out of 5 stars (12)
$23.68
In Stock.

Book Description

March 5, 2006 8590379825 978-8590379829 2
Lua is the language of choice for anyone who needs a scripting language that is simple, efficient, extensible, portable, and free. Currently, Lua is being used in areas ranging from embedded systems to Web development and is widely spread in the game industry, where knowledge of Lua is an indisputable asset. "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---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. This Second Edition updates the text to Lua 5.1 and brings substantial new material, including numerous new examples, a detailed explanation of the new module system, and two new chapters centered on multiple states and garbage collection.

Frequently Bought Together

Programming in Lua, Second Edition + Lua 5.1 Reference Manual + Lua Programming Gems
Price for all three: $71.27

Some of these items ship sooner than the others.

Buy the selected items together
  • Lua 5.1 Reference Manual $15.77
  • Lua Programming Gems $30.49

Customers Who Bought This Item Also Bought


Editorial Reviews

Review

"the book presents so many good ideas, and presents them so artfully, that it's worth reading." -- UnixReview.com, May 2004

About the Author

Roberto Ierusalimschy is an Associate Professor at the Catholic University in Rio de Janeiro. He is the leading architect of Lua.

Product Details

  • Paperback: 328 pages
  • Publisher: Lua.org; 2 edition (March 5, 2006)
  • Language: English
  • ISBN-10: 8590379825
  • ISBN-13: 978-8590379829
  • Product Dimensions: 7.4 x 0.7 x 9.7 inches
  • Shipping Weight: 1.3 pounds (View shipping rates and policies)
  • Average Customer Review: 4.7 out of 5 stars  See all reviews (41 customer reviews)
  • Amazon Best Sellers Rank: #293,980 in Books (See Top 100 in Books)

More About the Author

Roberto Ierusalimschy is an Associate Professor of Computer Science at PUC-Rio (the Pontifical Catholic University of Rio de Janeiro), where he works with programming-language design and implementation. He is the leading architect of the Lua programming language and the author of "Programming in Lua" (now in its third edition and translated to Chinese, Korean, German, and Japanese).

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 Distinguished ACM Speaker.

Customer Reviews

4.7 out of 5 stars
(41)
4.7 out of 5 stars
The book Programming in Lua is an excellent book on the Lua language. William Dere  |  16 reviewers made a similar statement
This book is very approachable and has a clear, concise writing style. Michael Lore  |  9 reviewers made a similar statement
If you want to be fluent in Lua or if you want to write extensions, you need this book. R. F. Smith  |  5 reviewers made a similar statement
Most Helpful Customer Reviews
106 of 112 people found the following review helpful
5.0 out of 5 stars Let the revolution begin December 16, 2003
Format:Paperback
The Lua programming Language has been around for a while but this book by Roberto Ierusalimschy will be a mark in its history. The book managed to surpass every expectation I had for it, and I was eager! From someone with no Lua knowledge to those with Lua klocs in their backs, this book will be a great companion in a nice to read trip down the Lua 5.0 lane.

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)

Comment | 
Was this review helpful to you?
37 of 38 people found the following review helpful
5.0 out of 5 stars A valuable multi-level book February 19, 2004
Format:Paperback
Lua is a free scripting language with an interesting development history. It is a language that is gaining wider acceptance thanks to small size, readable syntax, expressive power, efficiency, ANSI C portability and easy two-way integration with C and C++. It is also useful as a data-description language that can be tailored to one's needs.

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.

Comment | 
Was this review helpful to you?
23 of 23 people found the following review helpful
5.0 out of 5 stars Excellent book March 4, 2004
Format:Paperback
Lua is a gem among programming languages. Its designers have commendably placed a high value on keeping the language small, readable and portable. The diminutive size and simple syntax of Lua, however, belie a very rich, highly factored and stable architecture. It is a fun language in which to program. Lua dovetails beautifully with lower level languages by means of a C interface, and its drum tight language processor and libraries are right at home in event-driven graphical applications as well as console programs.

The excellent book "Programming in Lua" by Roberto Ierusalimschy provides developers with a broad summary of the language. The author includes a myriad of small examples, each of which is well focused and easily grasped. Different solutions to a given problem are often accompanied by benchmark figures. Prof. Ierusalimschy has an educator's gift for finding the appropriate level at which to write, and readers will appreciate the conversational nature of his writing. Unlike many programming language books, "Programming in Lua" has a strong content-to-fluff ratio throughout.

The book provides valuable explanations of language and library features which even the careful reader of the Lua reference manual might miss. In addition, over twenty C library entry points are discussed (and, thankfully, indexed) which are not mentioned in the reference manual.

It is hard to conceive of a software project which would not benefit from using Lua, both as an embedded component and as a standalone interpreter of scripts. The book "Programming in Lua" is valuable for anyone with an interest in this lovely language.

Was this review helpful to you?
Most Recent Customer Reviews
5.0 out of 5 stars The K&R Book for Lua
When I bought this book, as soon as I opened it I fell in love. It brought back memories of how wonderful the K&R book on C was. Read more
Published 5 months ago by Joseph Brown
5.0 out of 5 stars Nice book
This is the book that I exactly wanted. This book assumes that you have some previous exposure to programming and therefore doesn't waste time explaining what loops and conditional... Read more
Published 8 months ago by Eunjung
3.0 out of 5 stars An Introduction Mainly for C Programmers
This is the first programming language I decided to pick up. I can tell the book tries to cater to both new and experienced programmers, but tends to lean towards the latter more... Read more
Published 10 months ago by Pancake
5.0 out of 5 stars Fantastic book
This is one of the few computer books where I straight up just read the chapters instead of just going for it with a computer and using a book as a reference. Read more
Published 11 months ago by K. Durivage
4.0 out of 5 stars Good language, but book a little confusing
After a while thinking, this book deserves only 4 stars, not because of the language (which is 5 or far more stars), but because of its little confusing back and forth, to and fro,... Read more
Published 22 months ago by Frederico Lopes
4.0 out of 5 stars To the point
I like the writing style of the book. To the point, at times I would say terse, with short example code. Read more
Published 22 months ago by Emile van Gerwen
5.0 out of 5 stars Knowledge is power
So i got an email to write a review for this book, this is the first review I've ever written for Amazon so here it goes. Read more
Published on May 20, 2011 by Brandon Wall
5.0 out of 5 stars Best Ever
"Programming in Lua" is the best programming book I have ever read.

I have programmed for over 30 years and have a bookshelf full of programming books; none are... Read more
Published on October 23, 2010 by NoFacade
5.0 out of 5 stars Roblox's Language
It is awesome it is the programing link for Roblox to get to there check this out

geicogeko is always tinkering with witty malls on <a href=[...]
Published on August 2, 2010
4.0 out of 5 stars An easy way to get started
Something was in the air back in the 90s. Whatever it was, it spawned an entire generation of scripting languages, Lua among them. Read more
Published on July 25, 2010 by wiredweird
Search Customer Reviews
Only search this product's reviews



Books on Related Topics (learn more)

What Other Items Do Customers Buy After Viewing This Item?


Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

Forums

There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Listmania!


Create a Listmania! list

So You'd Like to...


Create a guide


Look for Similar Items by Category