A realistic first-month plan for lua programming

Thirty days, four evenings a week, one rule: every week ends with something that runs. That is the whole plan. Lua’s surface is small enough to cover the syntax in about a week, so the remaining three weeks go to making small programs behave, which is the part that actually sticks.

Week one: values, decisions, loops

Install a current Lua binary and confirm the version at the prompt. Then work through the pieces you will use constantly: numbers, strings, booleans, nil, if and elseif, while, numeric for, and ipairs. Read about each for ten minutes, then type it until it does something visible.

The week’s deliverable is a command-line tool of 40 to 60 lines: a tip splitter, a temperature converter, a unit converter. Read its arguments from arg, print a formatted result, and handle one bad input case. Structure does not matter yet.

Spend three sessions typing and one session reading. If a concept resists, write it down and move on; the loop comes back in week two anyway.

Week two: tables and functions

Tables are the language’s entire data model, so give them a full week. Build the same information two ways: as a list with numeric keys, and as a record with named fields. Then nest one inside the other, because that is what real data looks like.

Functions come next: parameters, multiple return values, varargs, and scope. Write helpers that take a table as an argument and return a new one rather than mutating the input, at least while learning.

Your project is an in-memory contact list with four operations — add, find, list, remove — each implemented as a function that receives the table. One rule for the week: no globals except a single entry point.

Week three: files, modules, errors

Now let the program outlive a single run. Use io.open to read and write a plain text file, and check the return value instead of assuming success. Split the contact list into a module loaded with require, and call it from a small main script.

Add error handling with pcall and error. Make the program say something useful when the data file is missing rather than crashing with a traceback. That one habit separates a script you tolerate from a script you trust.

Deliverable: the contact list loads on startup and saves on exit, with a clear message when the save path is unwritable.

Week four: one complete tool

  1. Pick something you would genuinely use: renaming screenshots by date, summarising a log file, converting a CSV to a Lua table.
  2. Write the README before the code, naming the exact command and one example input.
  3. Build the smallest version that handles a single file correctly.
  4. Add argument handling, then a short smoke test that runs on a sample file.
  5. Use it once for real, on real files, and fix only what that use exposes.

If time remains, improve the error messages rather than adding features. Messages are what you will read for the next year.

What this plan leaves out on purpose

Metatables beyond a first look, coroutines, the C API, and the wider LuaRocks ecosystem all wait. They are worth learning, but each pays off only after you can comfortably write a few hundred lines of ordinary Lua. Four weeks will not make you fluent. It will make you independent enough to read the reference manual and keep going without a course.