How Lua calls C functions through its stack-based API and how to package those functions as a module.
Software notes and practical experiments
This is the English entry point to Nanfeng's development blog. The archive currently contains Chinese-language technical notes; English translations will be published progressively.
An Overview of the Lua C API
A practical overview of the Lua C API, including the stack, errors, calls, and memory allocation.
Handling Keyboard Input in Cocos2d-x with Lua
Registering and removing a keyboard event listener in a Cocos2d-x 3.17 Lua project.
Cooperative Multitasking with Lua Coroutines
Using Lua coroutines to coordinate asynchronous work without confusing cooperation with parallel execution.
Reflection and Introspection with Lua's Debug Library
Inspecting functions, locals, upvalues, coroutines, and execution with Lua's debug library.
Lua Coroutines Explained
Coroutine states, resume and yield values, iterators, and event-driven program structure in Lua.
Understanding Garbage Collection in Lua
Weak tables, caches, finalizers, and practical control of Lua's garbage collector.
Understanding Environments in Lua
How _G, _ENV, dynamic globals, module environments, and explicit load environments work in Lua.
How to Shuffle an Array in Lua
An unbiased Fisher-Yates shuffle for Lua arrays, with in-place and copied variants.
Object-Oriented Programming in Lua
Implementing objects, classes, inheritance, privacy, and callable objects with Lua tables and metatables.