Jump to content
Nytro

Programming in Lua

Recommended Posts

Programming in Lua

lua_capa05.jpg

The book is a detailed and authoritative introduction to all aspects of Lua programming, by Lua's chief architect. The first edition was aimed at Lua 5.0 and remains largely relevant. (See the errata.)

If you find this online version useful, please consider buying a copy of the second edition, which updates the text to Lua 5.1 and brings substantial new material. This helps to support the Lua project.

For the official definition of the Lua language, see the reference manual.

Contents

* Preface
* Audience
* Other Resources
* A Few Typographical Conventions
* About the Book
* Acknowledgments
*

* Part I · The Language

* 1 - Getting Started
o 1.1 - Chunks
o 1.2 - Global Variables
o 1.3 - Some Lexical Conventions
o 1.4 - The Stand-Alone Interpreter

* 2 - Types and Values
o 2.1 - Nil
o 2.2 - Booleans
o 2.3 - Numbers
o 2.4 - Strings
o 2.5 - Tables
o 2.6 - Functions
o 2.7 - Userdata and Threads

* 3 - Expressions
o 3.1 - Arithmetic Operators
o 3.2 - Relational Operators
o 3.3 - Logical Operators
o 3.4 - Concatenation
o 3.5 - Precedence
o 3.6 - Table Constructors

* 4 - Statements
o 4.1 - Assignment
o 4.2 - Local Variables and Blocks
o 4.3 - Control Structures
+ 4.3.1 - if then else
+ 4.3.2 - while
+ 4.3.3 - repeat
+ 4.3.4 - Numeric for
+ 4.3.5 - Generic for
o 4.4 - break and return

* 5 - Functions
o 5.1 - Multiple Results
o 5.2 - Variable Number of Arguments
o 5.3 - Named Arguments

* 6 - More about Functions
o 6.1 - Closures
o 6.2 - Non-Global Functions
o 6.3 - Proper Tail Calls

* 7 - Iterators and the Generic for
o 7.1 - Iterators and Closures
o 7.2 - The Semantics of the Generic for
o 7.3 - Stateless Iterators
o 7.4 - Iterators with Complex State
o 7.5 - True Iterators

* 8 - Compilation, Execution, and Errors
o 8.1 - The require Function
o 8.2 - C Packages
o 8.3 - Errors
o 8.4 - Error Handling and Exceptions
o 8.5 - Error Messages and Tracebacks

* 9 - Coroutines
o 9.1 - Coroutine Basics
o 9.2 - Pipes and Filters
o 9.3 - Coroutines as Iterators
o 9.4 - Non-Preemptive Multithreading

* 10 - Complete Examples
o 10.1 - Data Description
o 10.2 - Markov Chain Algorithm
*

* Part II · Tables and Objects

* 11 - Data Structures
o 11.1 - Arrays
o 11.2 - Matrices and Multi-Dimensional Arrays
o 11.3 - Linked Lists
o 11.4 - Queues and Double Queues
o 11.5 - Sets and Bags
o 11.6 - String Buffers

* 12 - Data Files and Persistence
o 12.1 - Serialization
+ 12.1.1 - Saving Tables without Cycles
+ 12.1.2 - Saving Tables with Cycles

* 13 - Metatables and Metamethods
o 13.1 - Arithmetic Metamethods
o 13.2 - Relational Metamethods
o 13.3 - Library-Defined Metamethods
o 13.4 - Table-Access Metamethods
+ 13.4.1 - The __index Metamethod
+ 13.4.2 - The __newindex Metamethod
+ 13.4.3 - Tables with Default Values
+ 13.4.4 - Tracking Table Accesses
+ 13.4.5 - Read-Only Tables

* 14 - The Environment
o 14.1 - Accessing Global Variables with Dynamic Names
o 14.2 - Declaring Global Variables
o 14.3 - Non-Global Environments

* 15 - Packages
o 15.1 - The Basic Approach
o 15.2 - Privacy
o 15.3 - Packages and Files
o 15.4 - Using the Global Table
o 15.5 - Other Facilities

* 16 - Object-Oriented Programming
o 16.1 - Classes
o 16.2 - Inheritance
o 16.3 - Multiple Inheritance
o 16.4 - Privacy
o 16.5 - The Single-Method Approach

* 17 - Weak Tables
o 17.1 - Memoize Functions
o 17.2 - Object Attributes
o 17.3 - Revisiting Tables with Default Values
*

Part III · The Standard Libraries

* 18 - The Mathematical Library

* 19 - The Table Library
o 19.1 - Array Size
o 19.2 - Insert and Remove
o 19.3 - Sort

* 20 - The String Library
o 20.1 - Pattern-Matching Functions
o 20.2 - Patterns
o 20.3 - Captures
o 20.4 - Tricks of the Trade

* 21 - The I/O Library
o 21.1 - The Simple I/O Model
o 21.2 - The Complete I/O Model
+ 21.2.1 - A Small Performance Trick
+ 21.2.2 - Binary Files
o 21.3 - Other Operations on Files

* 22 - The Operating System Library
o 22.1 - Date and Time
o 22.2 - Other System Calls

* 23 - The Debug Library
o 23.1 - Introspective Facilities
+ 23.1.1 - Accessing Local Variables
+ 23.1.2 - Accessing Upvalues
o 23.2 - Hooks
o 23.3 - Profiles
*

Part IV · The C API

* 24 - An Overview of the C API
o 24.1 - A First Example
o 24.2 - The Stack
+ 24.2.1 - Pushing Elements
+ 24.2.2 - Querying Elements
+ 24.2.3 - Other Stack Operations
o 24.3 - Error Handling with the C API
+ 24.3.1 - Error Handling in Application Code
+ 24.3.2 - Error Handling in Library Code

* 25 - Extending your Application
o 25.1 - Table Manipulation
o 25.2 - Calling Lua Functions
o 25.3 - A Generic Call Function

* 26 - Calling C from Lua
o 26.1 - C Functions
o 26.2 - C Libraries

* 27 - Techniques for Writing C Functions
o 27.1 - Array Manipulation
o 27.2 - String Manipulation
o 27.3 - Storing State in C Functions
+ 27.3.1 - The Registry
+ 27.3.2 - References
+ 27.3.3 - Upvalues

* 28 - User-Defined Types in C
o 28.1 - Userdata
o 28.2 - Metatables
o 28.3 - Object-Oriented Access
o 28.4 - Array Access
o 28.5 - Light Userdata

* 29 - Managing Resources
o 29.1 - A Directory Iterator
o 29.2 - An XML Parser

Online:

http://www.lua.org/pil/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...