Jump to ratings and reviews
Rate this book

Programming in Lua

Rate this book
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.

328 pages, Paperback

First published January 1, 2001

Loading interface...
Loading interface...

About the author

Roberto Ierusalimschy

8 books14 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
122 (29%)
4 stars
172 (42%)
3 stars
93 (22%)
2 stars
16 (3%)
1 star
4 (<1%)
Displaying 1 - 28 of 28 reviews
Profile Image for Charles H.
10 reviews1 follower
September 24, 2007
The two star rating for this book is by no means a reflection of the Lua language itself. Simply, "Programming in Lua" just isn't a good resource for learning the language--though sadly, it may be the best one that exists. "PiL" as the elite Lua hackers call it has at least these problems:
1.) Incorrect examples - some of the code given simply doesn't work.
2.) Questionable chapter ordering - some rather obscure topics come before useful ones
3.) No redundancies - the book is too minimalist for its own good. When writing code in an unfamiliar tongue (keyboard?), it's easy to make a simple typo or to have a slightly different setup. If things don't go exactly according to plan, don't expect PiL to help you out.
4.) Few explanations - Lua does things differently than other languages. Sometimes it'd be nice to know why. The writers saw no reason to enlighten the reader as to their motives.
5.) References required - sometimes a concept from later chapters would sneak its way into an earlier chapter. This stealthy tidbit would often go unnoticed by the authors so the reader will want to have the reference manual close at hand.

The saving grace of PiL is it's excellent companion book, the Lua Reference Manual. It is concise and informative, well organized, and has all the appendices you could ever want yet weighs in at under 100 pages. I often wondered if it wouldn't be the superior text from which to learn the language.
Profile Image for Bejoy Mathew.
77 reviews15 followers
October 1, 2021
Intended for people who already have some experience in other languages. I paired it up with some exercism questions to get some practice with the syntax
2 reviews
September 8, 2017
This book is fantastic for anyone interested in the field of programming. It's a bit of a slog to get through the first time, but after the first read and 1-2 years of programming experience, this becomes a wonderful reference manual. Don't be like me - read this book before trying anything related to Lua. It'll help you get the basics down.
Profile Image for Helena.
35 reviews
November 11, 2021
This is not a book for beginners who want to learn programming. This is a book for programmers on how to program in Lua. Because of this it is short and to the point. There are a few examples in every chapter. No exercises. The first edition is old but still mostly relevant and it's available for free at lua.org
Profile Image for Szbld.
2 reviews1 follower
May 16, 2017
I liked the "text" part of this book very much (it wold be *****) but I found the code examples too cryptic. It was sometimes hard to say if the code is actual "live" working code or just proof of concept in "pseudo code" with "lua like" syntax.
Profile Image for Elias Daler.
31 reviews6 followers
January 21, 2018
This book is the only thing you need to read about Lua to know almost everything you'll ever need. It explains everything very clearl and has lots of interesting examples. I always recommend it for anyone who wants to learn Lua.
3 reviews
June 4, 2021
If you're new to programming this book will make no sense, avoid it. If you know programming and are particularly familiar with interpreted languages like Javascript, Python this book will frustrate you.
This is not a well-planned or structured book, pedagogical progression is almost non-existent with impulsively written paragraphs and randomly scattered chapters which you waste cognitive resources to untangle for a subject that could be studied in just one afternoon otherwise. If there's one thing more annoying than a badly written thick book is a badly written thin book, and this is it. The fact that the author is professor at a university further adds to the disappointment.
As for Lua, it is simply a pre-ES6 Javascript-like language without the enforced single-threaded event loop, using do/begin/then...end to delimit blocks instead of braces; it adds some operator overloading, destructuring assignment/multiple value function returns, coroutine support in standard library and uses uncanny terms to describe well-known data structures (table for Javascript object/associative array, constructor for object literal, chunk for module/file/compilation unit, confusingly describes sequence, list, array) and you have to go over at least 150 pages of musings and babbling just to figure this out. This book does not deserve more than 2 stars but I'll give one more because it is written by core designer of the language and is the only canonical text apart from the reference manual.
Profile Image for Angelique.
17 reviews19 followers
November 22, 2017
A good reference book for those who want to understand Lua. Well written and explained, although you will need a basic background to understand some of the terms. The contents of this book is available online, but not as updated as this book.
Profile Image for Tae.
53 reviews14 followers
October 24, 2021
Why is Lua so weird? Here are the answers! The book covers more than most people will use, from how to write applications to how to embed Lua in bigger C systems. If you want to learn Lua to script Neovim the second edition is the one you are looking for
170 reviews4 followers
November 29, 2019
Seems like a good thorough, readable introduction, though I haven’t gone far enough into Lua yet to judge it overall.

I read the newest edition- orange cover, Lua 5.2.
Profile Image for Gustavo.
15 reviews
October 10, 2020
Awesome book with a pleasure reading. It covers almost all you need to written Lua applications. The author could have written about unit tests too.
October 9, 2014
One of the better lua references. It is by no means complete nor does it claim to be.

This book focuses on some main topics, that as a lua scripter, you will likely need to know. If you are a modder and scripting in lua you should read this first. Lua is a "different" language with a few abnormal (nothing wrong with that) concepts and I'm not just talking about functional programming.

There are good examples and explanations of WHY things work the way they do, and of some of the peculiarities of lua. This helped clear up a number of things.

The official online reference manual is *extremely* technical and accurate but not one but pragmatic. After reading this book, the reference manual will be your friend.
Profile Image for Michael.
162 reviews73 followers
January 14, 2012
Excellent introduction to Lua, directly from the language's designers. The book is well structured: part 1 introduces the core language whereas part 2 gives an in-depth explanation of tables and objects. This is followed by an overview of the standard library in in part 3 and rounded off by introducing Lua's C API in part 4.

If you want to learn Lua, you probably can't do much better than this, I feel like I learned a lot in a rather short time. However, the writing style is a bit on the dry and boring side, hence only 4 stars.
Profile Image for 龍帝.
73 reviews1 follower
October 25, 2014
Really Good book. Few boring parts, but examples are straightforward and easy to read.
Lua seems to be a really good language ; I don't like its OOP part ; the tables are definitely powerful but they aren't that easy to master. Everything else is pretty neat.

_Previous programming experience is needed to enjoy the book & the language._
Profile Image for Alvaro Tejada Galindo.
177 reviews5 followers
April 4, 2017
The book is good...written by one of the authors of Lua...it introduce all of the things that makes Lua a cool language...but...I can't give it 5 stars simply because, no matter how cool it is...Lua fails to really excite me as a language...cool to learn...but doesn't get me in the mood of thinking about starting a big project with it...
Profile Image for TK Keanini.
305 reviews71 followers
June 25, 2007
LUA is a beautiful design and this book is a great complement to the Reference Manual that can be downloaded with the code.
LUA is simple and elegant and near perfect at meetings its objectives.
12 reviews
February 4, 2008
Nice and concise, yet still packed with plenty of information. Probably describes the language just as well. Homage to Kernighan and Ritchie.
27 reviews1 follower
June 16, 2015
A well-written, fast-paced introduction to Lua. Simple prose. Good exposition. Useful reference.
Profile Image for Pedro.
91 reviews
July 13, 2015
He was my professor in college and I had the opportunity to work in the first versions of Lua. Great book.
Profile Image for Ahmet.
4 reviews
August 7, 2015
This is a must read book for those who wants to learn/program in Lua. The language is really lightweight and a good fit to be embedded in other applications.
Profile Image for Raido Uudel.
19 reviews
September 8, 2016
It was informative enough. A bit badly structured, perhaps but I am no expert in programming language book structuring.
Displaying 1 - 28 of 28 reviews

Can't find what you're looking for?

Get help and learn more about the design.