Terms and Conditions:
Roberto Ierusalimschy wrote:Copyright © 2003-2004 Roberto Ierusalimschy. All rights reserved.
Programming in Lua
This online book is for personal use only. It cannot be copied to other web sites or further distributed in any form.
is the official book about Lua [wiki]
, giving a solid base for programmers who want to use the scripting language.
Lua users typically fall into three broad groups: those that use Lua already embedded in an application program, those that use Lua stand alone, and those that use Lua and C together.
This book has much to offer to all those people. The first part covers the language itself, showing how we can explore all its potential. Here, this book focuses on different language constructs and use numerous examples to show how to use them for practical tasks. Some chapters in this part cover basic concepts, such as control structures. But there are also advanced (and original) topics, such as iterators and coroutines.
The second part is entirely devoted to tables, the sole data structure in Lua. Its chapters discuss data structures, persistence, packages, and object-oriented programming. There this book will unveil the real power of the language.
The third part presents the standard libraries. This part is particularly useful for those that use Lua as a stand-alone language, although many other applications also incorporate all or part of the standard libraries. This part devotes one chapter to each standard library: the mathematical library, the table library, the string library, the I/O library, the operating system library, and the debug library.
Finally, the last part of the book covers the API between Lua and C, for those that use C to get the full power of Lua. This part necessarily has a flavor quite different from the rest of the book. There we will be programming in C, not in Lua; therefore, we will be wearing a different hat. For some readers, the discussion of the C API may be of marginal interest; for others, it may be the most relevant part of this book.
Amazon.com (the second edition)
:) "Written by Lua creator himself this book offers great walkthrough the Lua language, includes many useful examples and shows variety of important Lua coding ideoms that comprise so called "Lua programming style". As an expert C/C++/Ruby coder but a novice Lua programmer I found PiL2 a great jump start in the languge."
:) "The book is well organized. It works as both a primer and complete course on the language. It covers the basic tenets and first principles, as well as the subtleties. It is written in the spirit of Lua: accomplishing much in minimal space. It does so through crisp, engaging writing and thorough, well-crafted examples."