Skip to content
New this month 24 fresh C++, C#, F#, JavaScript, TypeScript and Lua courses just landed. Browse new releases Use code WELCOME10 for 10% off your first order · 14-day refund

Lua Coroutines and Metatables: The Cheat-Sheet Course

The two Lua features people fake for years, explained properly in under an hour.

Rated 4.0 out of 5 from 3 reviews 36 students

VC Created by Victor Chen

  • Last updated August 2026
  • English
  • 52m of material
  • 7 lessons

What you will learn

6 concrete outcomes

Every bullet below is something you will have built, shipped or be able to explain by the time you finish the last lesson.

  • Use index and newindex for defaults, proxies and read-only tables
  • Implement inheritance and operator overloading without copied boilerplate
  • Understand coroutine create, resume, yield, status and wrap precisely
  • Write generators that produce values lazily inside a for loop
  • Build a cooperative scheduler that runs many tasks in a single frame loop
  • Sequence animations and cutscenes as straight-line code instead of state flags

Course curriculum

4 modules · 7 lessons · 52m of material

2 lessons running 16m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

2 lessons running 14m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

2 lessons running 16m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

1 lesson running 6m in total. Each lesson ships with the finished source files and a short written recap, so you can follow along in your own editor and skim the module again later.

Lesson-by-lesson titles, code downloads and exercises live inside the course library you get access to straight after checkout.

4 modules · 7 lessons

52m total length

Requirements

Short list, and deliberately so. If you meet these you can start today.

  • Basic Lua: tables, functions and the for loop
  • Lua 5.4 or any embedded Lua host you can run snippets in

About this course

Two features carry most of Lua expressive power, and both are usually worked around rather than learned. Metatables get replaced by copied class boilerplate nobody understands, and coroutines get replaced by timers and state flags. This short course fixes both in a single sitting.

The metatable half walks every metamethod worth knowing: index and newindex for property access and defaults, the arithmetic and comparison metamethods, call for callable tables, tostring for debugging, and the garbage-collection metamethod. You will implement inheritance, read-only tables, memoising tables and a proxy that logs writes, each in a few lines.

The coroutine half covers create, resume, yield, status and wrap, then shows the three shapes that appear in real code: a generator producing values lazily, a cooperative scheduler running many tasks in one loop, and a sequenced animation or cutscene that reads top to bottom instead of as a state machine. A printable cheat sheet lists every metamethod and coroutine function with a one-line example.

Frequently asked questions

Still unsure about something? Write to misteryjj100@gmail.com and a human answers, usually the same working day.

Metatables behave identically. Coroutines exist but Roblox prefers the task library, and the cheat sheet includes the equivalent task functions.

It assumes you already write basic Lua. If you do not yet, start with Lua from Scratch and treat this as the follow-up reference.

Lua coroutines are closer to Python generators than to JavaScript promises, because you control every resume yourself. A short lesson maps all three so the comparison is concrete.

Checkout is handled on our provider's secure payment page. The moment your payment clears we email your personal access link and access code to the address you used at checkout, and the same link appears in your account library. There is nothing to install and nothing to wait for.

Email misteryjj100@gmail.com within 14 days of your purchase, quote your order number, and we refund the full amount to your original payment method. No form to fill in and no questions about how much of the course you watched.

What students say

Reviews are written by people who bought this course. We publish the critical ones too.

4.0

Rated 4.0 out of 5

Course rating · 3 reviews

Rating distribution

  • 5 stars 33%
  • 4 stars 33%
  • 3 stars 33%
  • 2 stars 0%
  • 1 star 0%
  • JM

    Jonas Meier

    Game developer

    Feb 2026
    Rated 5.0 out of 5

    Twelve minutes and __index made sense

    Three years of Lua and I had faked metatables the whole time by copying an OOP snippet forward from project to project. Walking through exactly what happens on a missed table lookup, one step at a time, fixed that permanently.
  • AN

    Amara Nwosu

    Freelance game dev

    Oct 2025
    Rated 4.0 out of 5

    Coroutine half is the stronger half

    Building a small cooperative scheduler out of nothing but resume and yield is an excellent piece of teaching and I have already reused the shape of it. The inheritance material moves faster and skips rawget, which you meet the moment you write a real class.
  • BI

    Bogdan Ilie

    Roblox developer

    Apr 2025
    Rated 3.0 out of 5

    Never says which Lua it targets

    Two of the metamethod demonstrations do not behave the same way on the Luau runtime I work in every day, and at no point does the course state a version. I worked it out from context in the end. If you are arriving from Roblox, expect to verify everything against your own runtime before you trust it.

Your instructor

VC

Victor Chen

Lua developer and game-scripting instructor

  • 65 students taught
  • 4 courses published
  • 4.1 instructor rating
  • Lua
  • Roblox
  • LÖVE 2D
  • Game scripting

Victor has spent most of his career on the scripting side of games, from Roblox experiences with a live player base to small LÖVE 2D releases he built entirely himself. He teaches Lua as an embedded language first — tables, metatables, coroutines and the C boundary — because that is what makes an engine's API stop feeling arbitrary. Every course ends with something playable and, more usefully, something you can keep changing without it falling over. He runs a scripting help channel that has outgrown him twice.

$7 USD

One-time payment · lifetime access

The WisdomCharms dispatch

One useful email a week. No fluff, no spam.

New course releases, discount codes before anyone else, and a short, practical breakdown of one technique — a prompt pattern, a C++ idiom, a TypeScript trick — that you can use the same day.

  • Subscriber-only launch pricing
  • Unsubscribe in one click
  • We never sell your address

By subscribing you agree to our Privacy Policy. Questions? Write to misteryjj100@gmail.com.