Journal
A journal of my learning progress and solutions in the LUA language.
Self Learning
I am currently using github’s version tracking as a way to track my progress through Programming in Lua: First Edition as my guide to learning LUA. Version tracking allows me to show to myself and other the actual progress of my work including revisions to my code. I chose the first edition because it is constant, readily available, and most importantly, free for all to enjoy. I intend this repository to be a learning reference for myself and others.
Attribution
- Code samples examples are derived and/or paraphrased in my own language from Programming in Lua: First Edition.
Table Of Contents.
Course Parts
are organized as folders, with Chapters
in individual markdown .md
files within for easy reading.
Part 1 - The Language
01 - Complete - Getting Started
- 1.1 - Chunks
- 1.2 - Global Variables
- 1.3 - Some Lexical Conventions
- 1.4 - The Stand-Alone Interpreter
02 - Complete - Types and Values
- 2.1 - Nil
- 2.2 - Booleans
- 2.3 - Numbers
- 2.4 - Strings
- 2.5 - Tables
- 2.6 - Functions
- 2.7 - Userdata and Threads
03 - Complete - Expressions
- 3.1 - Arithmetic Operators
- 3.2 - Relational Operators
- 3.3 - Logical Operators
- 3.4 - Concatenation
- 3.5 - Precedence
- 3.6 - Table Constructors
04 - Complete - Statements
- 4.1 - Assignment
- 4.2 - Local Variables and Blocks
- 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
- 4.4 - break and return
05 - Complete - Functions
- 5.1 - Multiple Results
- 5.2 - Variable Number of Arguments
- 5.3 - Named Arguments
06 - Complete - More about Functions
- 6.1 - Closures
- 6.2 - Non-Global Functions
- 6.3 - Proper Tail Calls
07 - Complete - Iterators and the Generic for
- 7.1 - Iterators and Closures
- 7.2 - The Semantics of the Generic for
- 7.3 - Stateless Iterators
- 7.4 - Iterators with Complex State
- 7.5 - True Iterators
08 - Complete - Compilation, Execution, and Errors
- 8.1 - The require Function
- 8.2 - C Packages
- 8.3 - Errors
- 8.4 - Error Handling and Exceptions
- 8.5 - Error Messages and Tracebacks
09 - Complete - Coroutines
- 9.1 - Coroutine Basics
- 9.2 - Pipes and Filters
- 9.3 - Coroutines as Iterators
- 9.4 - Non-Preemptive Multithreading
Part 2 - Tables and Objects
11 - None - Data Structures
- 11.1 - Arrays
- 11.2 - Matrices and Multi-Dimensional Arrays
- 11.3 - Linked Lists
- 11.4 - Queues and Double Queues
- 11.5 - Sets and Bags
- 11.6 - String Buffers
12 - None - Data Files and Persistence
- 12.1 - Serialization
- 12.1.1 - Saving Tables without Cycles
- 12.1.2 - Saving Tables with Cycles
13 - None - Metatables and Metamethods
- 13.1 - Arithmetic Metamethods
- 13.2 - Relational Metamethods
- 13.3 - Library-Defined Metamethods
- 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 - None - The Environment
- 14.1 - Accessing Global Variables with Dynamic Names
- 14.2 - Declaring Global Variables
- 14.3 - Non-Global Environments
15 - None - Packages
- 15.1 - The Basic Approach
- 15.2 - Privacy
- 15.3 - Packages and Files
- 15.4 - Using the Global Table
- 15.5 - Other Facilities
16 - None - Object-Oriented Programming
- 16.1 - Classes
- 16.2 - Inheritance
- 16.3 - Multiple Inheritance
- 16.4 - Privacy
- 16.5 - The Single-Method Approach
17 - None - Weak Tables
- 17.1 - Memoize Functions
- 17.2 - Object Attributes
- 17.3 - Revisiting Tables with Default Values
Part 3 - The Standard Libraries
20 - None - The String Library
- 20.1 - Pattern-Matching Functions
- 20.2 - Patterns
- 20.3 - Captures
- 20.4 - Tricks of the Trade
21 - None - The I/O Library
- 21.1 - The Simple I/O Model
- 21.2 - The Complete I/O Model
- 21.2.1 - A Small Performance Trick
- 21.2.2 - Binary Files
- 21.3 - Other Operations on Files
23 - None - The Debug Library
- 23.1 - Introspective Facilities
- 23.1.1 - Accessing Local Variables
- 23.1.2 - Accessing Upvalues
- 23.2 - Hooks
- 23.3 - Profiles
Part 4 - The C API
24 - None - An Overview of the C API
- 24.1 - A First Example
- 24.2 - The Stack
- 24.2.1 - Pushing Elements
- 24.2.2 - Querying Elements
- 24.2.3 - Other Stack Operations
- 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 - None - Extending your Application
- 25.1 - Table Manipulation
- 25.2 - Calling Lua Functions
- 25.3 - A Generic Call Function
27 - None - Techniques for Writing C Functions
- 27.1 - Array Manipulation
- 27.2 - String Manipulation
- 27.3 - Storing State in C Functions
- 27.3.1 - The Registry
- 27.3.2 - References
- 27.3.3 - Upvalues
28 - None - User-Defined Types in C
- 28.1 - Userdata
- 28.2 - Metatables
- 28.3 - Object-Oriented Access
- 28.4 - Array Access
- 28.5 - Light Userdata