Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Preface
I. The Language
1. Getting Started
Chunks
Some Lexical Conventions
Global Variables
The Stand-Alone Interpreter
2. Types and Values
Nil
Booleans
Numbers
Strings
Literal strings
Long strings
Coercions
Tables
Functions
Userdata and Threads
3. Expressions
Arithmetic Operators
Relational Operators
Logical Operators
Concatenation
The Length Operator
Precedence
Table Constructors
4. Statements
Assignment
Local Variables and Blocks
Control Structures
if then else
while
repeat
Numeric for
Generic for
break, return, and goto
5. Functions
Multiple Results
Variadic Functions
Named Arguments
6. More about Functions
Closures
Non-Global Functions
Proper Tail Calls
7. Iterators and the Generic for
Iterators and Closures
The Semantics of the Generic for
Stateless Iterators
Iterators with Complex State
True Iterators
8. Compilation, Execution, and Errors
Compilation
Precompiled Code
C Code
Errors
Error Handling and Exceptions
Error Messages and Tracebacks
9. Coroutines
Coroutine Basics
Pipes and Filters
Coroutines as Iterators
Non-Preemptive Multithreading
10. Complete Examples
The Eight-Queen Puzzle
Most Frequent Words
Markov Chain Algorithm
II. Tables and Objects
11. Data Structures
Arrays
Matrices and Multi-Dimensional Arrays
Linked Lists
Queues and Double Queues
Sets and Bags
String Buffers
Graphs
12. Data Files and Persistence
Data Files
Serialization
Saving tables without cycles
Saving tables with cycles
13. Metatables and Metamethods
Arithmetic Metamethods
Relational Metamethods
Library-Defined Metamethods
Table-Access Metamethods
The __index metamethod
The __newindex metamethod
Tables with default values
Tracking table accesses
Read-only tables
14. The Environment
Global Variables with Dynamic Names
Global-Variable Declarations
Non-Global Environments
Using _ENV
_ENV and load
15. Modules and Packages
The require Function
Renaming a module
Path searching
Searchers
The Basic Approach for Writing Modules in Lua
Using Environments
Submodules and Packages
16. Object-Oriented Programming
Classes
Inheritance
Multiple Inheritance
Privacy
The Single-Method Approach
17. Weak Tables and Finalizers
Weak Tables
Memoize Functions
Object Attributes
Revisiting Tables with Default Values
Ephemeron Tables
Finalizers
III. The Standard Libraries
18. The Mathematical Library
19. The Bitwise Library
20. The Table Library
Insert and Remove
Sort
Concatenation
21. The String Library
Basic String Functions
Pattern-Matching Functions
The string.find function
The string.match function
The string.gsub function
The string.gmatch function
Patterns
Captures
Replacements
URL encoding
Tab expansion
Tricks of the Trade
Unicode
22. The I/O Library
The Simple I/O Model
The Complete I/O Model
A small performance trick
Binary files
Other Operations on Files
23. The Operating System Library
Date and Time
Other System Calls
24. The Debug Library
Introspective Facilities
Accessing local variables
Accessing non-local variables
Accessing other coroutines
Hooks
Profiles
IV. The C API
25. An Overview of the C API
A First Example
The Stack
Pushing elements
Querying elements
Other stack operations
Error Handling with the C API
Error handling in application code
Error handling in library code
26. Extending Your Application
The Basics
Table Manipulation
Calling Lua Functions
A Generic Call Function
27. Calling C from Lua
C Functions
Continuations
C Modules
28. Techniques for Writing C Functions
Array Manipulation
String Manipulation
Storing State in C Functions
The registry
Upvalues
Shared upvalues
29. User-Defined Types in C
Userdata
Metatables
Object-Oriented Access
Array Access
Light Userdata
30. Managing Resources
A Directory Iterator
An XML Parser
31. Threads and States
Multiple Threads
Lua States
32. Memory Management
The Allocation Function
The Garbage Collector
Garbage-collector’s API
Index
← Prev
Back
Next →
← Prev
Back
Next →