Embed Lua 5.4 in a C Host Application
Run Lua scripts from C, expose host functions, and shut down the Lua state safely.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Run Lua scripts from C, expose host functions, and shut down the Lua state safely.
Learn how Lua coroutines enable lightweight cooperative multitasking. A step‑by‑step guide to building an async file reader, trade‑offs, and best practices for reliable, non‑blocking Lua code.
Learn how to pick require or dofile for Lua modules, compare caching, error handling, and execution context, and see a concrete verification example.
Learn how to implement Love2D physics using Box2D, focusing on the critical pixel-to-meter scaling ratio and fixed time steps to prevent tunneling and unstable simulations.
Build reusable classes and single inheritance in Lua using metatables and __index. Covers constructor patterns, colon syntax, inheritance chains, rawget/rawset, shared metatables, and verification steps with a complete runnable example.
Learn how to implement framerate-independent movement and a basic state machine in Love2D to prevent jittery gameplay and messy code.
Lua coroutines provide cooperative pause and resume in a single thread. Learn how coroutine.create, resume, yield and status work together with a producer example, plus limits and common mistakes to avoid.
Stop using nested if-else blocks to manage your game screens. Learn when to use simple flagging versus the State Pattern in LÖVE to keep your game loop clean and scalable.
Shows how the <close> attribute invokes __close automatically when a variable leaves scope, ensuring resources like files are released even on error.