Unity C# Scripting Foundations: MonoBehaviours, Coroutines and Input
by Yuki Tanaka
Give your C or C++ engine a scripting layer using the Lua stack, LuaJIT and FFI.
VC Created by Victor Chen
Every bullet below is something you will have built, shipped or be able to explain by the time you finish the last lesson.
6 modules · 34 lessons · 4h 34m of material
7 lessons running 58m 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.
7 lessons running 54m 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.
8 lessons running 1h 04m 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.
6 lessons running 46m 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.
3 lessons running 24m 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.
3 lessons running 28m 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.
6 modules · 34 lessons
4h 34m total length
Short list, and deliberately so. If you meet these you can start today.
Every custom engine reaches the point where recompiling to change a jump height is intolerable, and Lua is the usual answer. Embedding it means learning the C API, which is small but unforgiving: everything moves through a virtual stack, and an off-by-one there produces corruption rather than a compile error.
The course starts with the stack model itself, pushing and popping values, absolute versus pseudo indices, and the discipline of checking your stack balance in every function. From there you register C functions callable from Lua, expose native objects with userdata and metatables, add garbage-collection metamethods that release native resources, and use the registry and upvalues to keep per-instance state without globals.
The later modules cover the parts that decide whether an embedded runtime survives production: sandboxing untrusted scripts by restricting the environment, error handling across the C boundary with protected calls, hot reloading modules while the game runs, an instruction-count hook to stop runaway loops, and profiling the boundary crossings themselves. A final module covers LuaJIT, its FFI as an alternative to hand-written bindings, and where the tracing compiler helps or does not.
Still unsure about something? Write to misteryjj100@gmail.com and a human answers, usually the same working day.
Reviews are written by people who bought this course. We publish the critical ones too.
4.0
Rated 4.0 out of 5Course rating · 2 reviews
Viktor Sandell
Engine programmer
Being made to draw the stack before and after every single C API call is tedious for about twenty minutes and then it becomes the reason your code works. Userdata lifetime is handled well too. Not five, because the sample build assumes a Unix toolchain and I lost an evening getting it running on Windows.
Marisol Aguirre
Game developer
Coverage of the reference C API is solid, and the sandboxing chapter is genuinely valuable if you let players write scripts. LuaJIT and the FFI get a single short chapter that largely points you at the documentation, which is a shame when both are named on the listing.
Lua developer and game-scripting instructor
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.
One-time payment · lifetime access