Lua Programming Gems

This book is a collection of articles recording some of the wisdom and practice on how to program well in Lua.

Lua Programming Gems edited by L. H. de Figueiredo, W. Celes, R. Ierusalimschy
Lua.org, December 2008
ISBN 978-85-903798-4-3
(also available as an e-book)

Read the front matter (containing the preface by the editors, forewords by Cameron Laird and by Mark Hamburg, and short biographies of the contributors) and Chapter 2 on Lua Performance Tips. See also the errata.

The entire book is freely available here. Buy a copy of the book and help to support the Lua project.

Contents

  1. Programming Techniques
    1. Lua Per-Thread Library Context
      Doug Currie
    2. Lua Performance Tips
      Roberto Ierusalimschy
    3. Vardump: The Power of Seeing What's Behind
      Tobias Sülzenbrück and Christoph Beckmann
    4. Serialization with Pluto
      Ben Sunshine-Hill
    5. Abstractions for LuaSQL
      Tomás Guisasola Gorham
    6. Bootstrapping a Forth in 40 Lines of Lua Code
      Eduardo Ochs
    7. Effecting Large-Scale Change (with little trauma) using Metatables
      Sérgio Alvares Maffra and Pedro Miller Rabinovitch

  2. Design Techniques
    1. MVC Web Development with Kepler
      André Carregal and Yuri Takhteyev
    2. Filters, Sources, Sinks, and Pumps
      Diego Nehab
    3. Lua as a Protocol Language
      Patrick Rapin
    4. Lua Script Packaging
      Han Zhao
    5. Objects, Lua-style
      Reuben Thomas
    6. Exceptions in Lua
      John Belmonte

  3. Algorithms and Data Structures
    1. Word Ladders
      Gavin Wraith
    2. Building Data Structures and Iterators in Lua
      Luis Carvalho
    3. A Primer of Scientific Computing in Lua
      Luis Carvalho
    4. Complex Structured Data Input
      Julio Manuel Fernández-Díaz
    5. Lua Implementations of Common Data Structures
      Matthew M. Burke
    6. Tic-Tac-Toe and the Minimax Decision Algorithm
      Rafael Savelli and Roberto de Beauclair Seixas

  4. Game Programming
    1. Using Lua in Game and Tool Creation
      Konstantin Sokharev and Vadim Groznov
    2. A Dynamic and Flexible Event System for Script-Driven Games
      Robert Oates
    3. Lua for Game Programming
      Steve Gargolinski
    4. Designing an Efficient Lua Driven Game Scripting Engine
      Nicolas Peri

  5. Embedding and Extending
    1. Enhanced Coroutines in Lua
      Patrick Rapin
    2. Using Lua in Pascal
      Jeremy Darling
    3. Porting Lua to a Microcontroller
      Ralph Hempel
    4. Writing C/C++ Modules for Lua
      Ralph Steggink and Wim Couwenberg
    5. Interpreted C Modules
      Jérôme Vuarand