The Pareto Method is a prioritization approach based on the Pareto principle, the observation that roughly 20% of inputs often produce about 80% of results. Applied to learning, you identify the small set of concepts, skills, or topics that deliver most of the value and focus your effort there first.
Skill Chaining is a teaching method that breaks a complex task into small, ordered steps and links them into one continuous sequence. Each step is mastered and then connected to the next, so the learner gradually builds the whole behavior from its parts.
The Pareto Method decides what to learn first, and Skill Chaining decides how to sequence it.
Together, they give you a prioritized core that you learn in a structured order.
Based on:
Programming in Lua, Fourth Edition
Roberto Ierusalimschy
Before the path, one honest note on the Pareto step: Programming in Lua is written as a reference, and roughly a third of it (the entire C API, plus GC internals, reflection, environments) serves a different goal than “become a competent Lua programmer.” The 20% that carries 80% of beginner value is a tight cluster: values, tables, functions, control flow, closures, pattern matching, modules, metatables. Everything else either supports that cluster or can wait.
Here is the value/cost analysis behind the prioritization, so you can see the reasoning rather than take it on faith:
| Tier | Chapters | Verdict |
|---|---|---|
| Core 20% — do first, in order | 1, 3, 4, 5, 6, 8, 9, 10, 14, 17, 20, 21 | Directly produces working programs. Every later step depends on these. |
| Supporting — read inside a chain | 7 (I/O), 15 (serialization), 16 (errors), 18 (iterators) | Needed to make the core usable, but thin slices only. |
| Later / optional | 24 (coroutines), 12 (date), 13 (bits), 23 (GC) | Real value, not foundational. Add after Chain 8 if you still have appetite. |
| Defer — separate skill | 22 (environments), 25 (reflection), 26, 27–33 (C API) | C API is a second language. Treat as a Part V you may never need. |
| Interludes — repurpose as checkpoints | 2, 11, 19 | Ch 2 sits absurdly early; hold the eight-queens puzzle until Chain 4. |
Total: ~9 of 33 chapters in the first pass. Roughly 10–12 weeks at 8–10 hrs/week.
How to use this document
Skill chaining only works if the links are small and gated. So every step below has three parts:
- Read — the exact sections, nothing more
- Drill — 20–40 minutes of typing code, not reading it
- Gate — a pass/fail test you must clear without looking anything up before advancing
If you fail a gate, repeat the drill. Do not advance on “I mostly get it.” That is the whole discipline.
Set up first: install Lua 5.4 from lua.org, and keep a scratch file plus a notes.md where you log each gate with the date you passed it.
Chain 1 — Values and the interpreter (Ch 1, 3, 4 partial)
Goal: you can make the interpreter do arithmetic and string work and understand what a value is.
- Read 1.1–1.3 (Chunks, Lexical Conventions, Global Variables). Drill: run ten one-line chunks in the REPL; deliberately trigger a syntax error and read the message. Gate: explain out loud why
print("hi")andprint "hi"both work. - Read 1.4 (Types and Values), Nil and Booleans subsections only. Drill: print the type of eight different literals. Gate: state which values are falsy in Lua. (Only two.)
- Read 3.1–3.5, skipping “Lua Before Integers” and “Representation Limits.” Drill: use
//,%,^,math.floor,math.max,math.randomcorrectly; note that%on negatives follows floor division. Gate: predict the output ofprint(-7 % 3)andprint(7 // -2)before running them, and be right. - Read 4.1, 4.2, 4.4 (Literal strings, Long strings, Coercions). Drill: build strings with
..,#,[[...]], andstring.rep. Gate: write a three-line program that centers a word in a 40-character rule of=signs, unaided. - Skim 3.6 (Precedence) — 10 minutes, reference only. Gate: add parentheses to
2 + 3 * 4 ^ 2so it evaluates as(2+3) * (4^2).
Ch 2 (eight queens) goes here only if you already know recursion from another language. Otherwise save it.
Chain 2 — Tables, then control flow (Ch 5, 8, then 6)
Tables are the single highest-value item in the entire book: arrays, dicts, objects, modules, and namespaces are all the same construct. Learn them before functions so that every later exercise has somewhere to put data.
- Read 5.1–5.3 (Indices, Constructors, Arrays/Sequences). Drill: build a list of five items, read index 1 and 5, build a
{name=..., age=...}record. Gate: explain whyt[#t]is the last element and why indexing at 0 is a beginner trap. - Read 5.4 (Traversal). Drill: sum a numeric array with
ipairs; print all key/value pairs withpairs. Gate: state which one stops at a nil hole. - Read 5.5 (Safe Navigation) and 5.6 (Table Library) —
table.insert,remove,concat,sort. Drill: sort a list of strings by length using a comparator function. Gate: insert into the middle of a list, then remove it, without corrupting the sequence. - Read 8.1 (Local Variables and Blocks). Drill: convert five globals in your scratch file to locals. Gate: explain the difference in lifetime between
local xandx. - Read 8.2 fully (if/while/repeat/numeric for/generic for). Drill: write a countdown with
while, a menu loop withrepeat, and afor i = 1, 10sum. Gate: write a program that prints the first 15 Fibonacci numbers using a numericfor. - Read 8.3 (
break,return,goto). Drill: break out of a nested loop usinggoto. Gate: explain whygotohere beats a flag variable. - Read 6.1–6.3 (Functions, Multiple Results, Variadic). Drill: a function returning two values; a vararg that sums its arguments with
select('#', ...). Gate: write a function that returns the min and max of a vararg list, and call it correctly inside aprint.
Ch 7 is not here. File I/O gets folded into Chain 5 where you have a reason to use it.
Chain 3 — Closures and higher-order functions (Ch 9, then 18 partial)
This is the conceptual hinge of the book. Get it wrong and OOP and coroutines later will feel like magic.
- Read 9.1 (First-Class Values). Drill: store three functions in a table; call them by key. Gate: pass a function to
table.sortas a comparator. - Read 9.2 (Non-Global Functions). Drill: define a function as a table field and call it with
t.f(); then witht:f()once you understand the colon. Gate: writet.greetso botht.greet(t)andt:greet()produce identical output. - Read 9.3 (Lexical Scoping). Drill: write a counter factory returning
incandget. Gate: build amake_account(balance)withdeposit/withdrawthat keepsbalanceprivate, and prove it can’t be touched from outside. - Read 9.4 (Functional Programming taste). Drill: write
mapandfilterover a list. Gate: compose them to get the squares of even numbers from 1–20. - Read 18.1–18.2 (Iterators and Closures; Semantics of Generic for). Drill: write a closure-based iterator over a list. Gate: drive it with a
for ... inloop and explain where the state lives.
Chain 4 — Pattern matching, then the puzzle (Ch 10, Ch 2, Ch 11)
- Read 10.1 (the four pattern functions). Drill:
string.find,match,gsub,gmatchon a log-like string. Gate: extract every number from a string withgmatch. - Read 10.2 (Patterns) — character classes, anchors, quantifiers. Drill: validate a simple
YYYY-MM-DDdate with an anchored pattern. Gate: write a pattern that matches only a lowercase word of 3–8 letters. - Read 10.3–10.4 (Captures, Replacements). Drill: swap
first last→last, firstwithgsuband captures. Gate: the URL-encode and tab-expand examples in 10.4, from scratch. - Read 10.5 (Tricks). Gate: explain why
%.differs from.in a pattern. - Now do Ch 2 — the eight-queens puzzle. You finally have the tools: arrays, loops, recursion, and a place to put the board. Gate: solve it for 8×8; then for 4×4 to verify your solver generalizes.
- Do Ch 11 — most-frequent-words, as a timed 45-minute exercise using
gmatchand a counting table. Gate: correct output on a 200-word sample text.
Chain 5 — Data structures, files, persistence (Ch 14, 7, 15)
- Read 14.1–14.4 (Arrays, Matrices, Linked Lists, Queues). Drill: implement a stack and a FIFO queue with the two-index trick. Gate: a queue that neither grows unboundedly nor loses ordering over 1,000 push/pop cycles.
- Read 14.5–14.8 (Reverse tables, Sets, String buffers, Graphs). Drill: a set for deduplication; a string buffer via
table.concat. Gate: dedupe a 5,000-word list in under a second and state the complexity of your approach versus naive..concatenation. - Read 7.1–7.3 (Simple I/O, Complete I/O, Other Operations). Drill: read a file line by line; write a file; append;
io.lines. Gate: read a file, count its lines, and write the count to a second file, with the handle closed on every path. - Read 15.1–15.2 (Data Files, Serialization). Drill: save a flat table to a file and reload it. Gate: round-trip a nested table of mixed types with
%qand a recursive serializer. - Skim 15.3–15.4 (cycles) — know that cycles need a visited set; implement only if curious.
Chain 6 — Errors and modules (Ch 16, 17)
- Read 16.3–16.4 (Errors, Error Handling). Drill:
error,assert,pcall,xpcallwith a handler. Gate: a function that validates its argument and fails cleanly, called insidepcall, with the caller deciding recovery. - Read 16.1–16.2 (Compilation, Precompiled Code) —
load,dofile. Gate: load a string of Lua from a file and run it; explain the difference fromdofile. - Read 17.1–17.3 (
require, renaming, path searching). Drill: two files, one requiring the other, returning a table. Gate: explain why a module should return a table and never set a global. - Read 17.4–17.5 (Basic module approach, submodules). Gate: restructure your Chain 5 code into
mylib.ioandmylib.stats, andrequireboth from amain.lua.
Chain 7 — Metatables and objects (Ch 20, 21)
- Read 20.1–20.2 (Arithmetic and Relational metamethods). Drill: a vector type with
__add,__eq,__tostring. Gate:print(v1 + v2)produces readable output andv1 == v2compares component-wise. - Read 20.3 (Library-defined metamethods) —
__call,__len,__concat. Gate: add__concatsov .. "!"works. - Read 20.4 (
__index,__newindex, defaults, read-only, tracking). Drill: a table with a default value via__index; a read-only proxy. Gate: a proxy that logs every write while still allowing reads through. - Read 21.1–21.2 (Classes, Inheritance). Drill: a
Shapeclass with anareamethod;CircleandSquareinheriting viasetmetatable. Gate: adescribe()method that dispatches correctly on all three types through inheritance. - Read 21.3–21.4 (Multiple Inheritance, Privacy). Gate: a class mixing in two behavior tables, with one truly private field.
- Skim 21.5–21.6 (Single-method, Dual representation) — read for the pattern, don’t implement.
Chain 8 — Coroutines (Ch 24, 18.3–18.5, 26)
- Read 24.1–24.2. Drill: a producer/consumer pair passing values through
resume/yield. Gate: a generator that yields lines, consumed by a loop, with clean termination. - Read 24.3–24.4. Gate: re-implement your Chain 3 iterator as a coroutine and argue which version is clearer for this case.
- Read 18.3–18.5 (Stateless iterators, ordered traversal, true iterators). Gate: a stateless iterator over a table with no closure state.
- Read 26. Gate: two coroutines interleaving without a shared mutable global.
Capstone (1–2 weeks)
A single program chaining every link: a log analyzer CLI.
mylib.parse— pattern-matching extraction of timestamp, level, messagemylib.stats— frequency table, error-rate computation, sorted outputmain.lua— arg parsing,require,pcall-wrapped run with a friendly failure path- A coroutine line-reader feeding the parser, so files stream instead of loading whole
- A
Reportclass with__tostring, plus a--jsonmode - Errors as tables carrying a code, formatted by an
xpcallhandler
Gate: runs on a 10,000-line sample without loading it all into memory, survives a malformed line, and exits non-zero with a clear message on a missing file.
Spaced review schedule
Re-pass a gate from a finished chain on days 3, 10, and 30. If a gate fails on review, drop back one chain for a day. Chains 3, 5, and 7 are the ones that decay fastest — schedule those reviews first.
What to deliberately skip, and revisit later
- Ch 13 (bits), 12 (date), 23 (GC) — after the capstone, if you’re building something that needs them.
- Ch 22 (environments) — read only when you touch sandboxing or
loadwith a custom_ENV. - Ch 25 (reflection) — when you need
debug.tracebackor profiling. - Ch 27–33 (C API) — a distinct project. Start at 27 only after the capstone ships; it demands C fluency first.
Two version notes so old material doesn’t confuse you: this is 5.4, so integers are a real subtype, bitwise operators exist, and unpack lives in table. If you find a tutorial using unpack(...) or math.pow, mentally map it forward rather than copying it.