Wun Code
Lua

Lua for Games

Learn the patterns that game scripts and game servers are built on, such as events, entities, timers and state machines.

Start the trackFree, no sign-up needed

What you'll learn

  • An event systemSubscribe with on and fire with emit
  • Entities and componentsAn update loop that safely removes the dead
  • The player's inventoryCapped stacks and returning the overflow
  • CooldownsThe canUse, use and remaining functions
  • A state machineClear transitions with enter and exit hooks
  • A coroutine schedulerPause with yield and continue with resume
  • Vectors with metatablesWrite pos + vel * dt just like in math
  • Collision detectionRectangles, circles and shapes that only touch
  • Calculating damageArmor, critical hits and dying only once
  • Saving and loading the gameFrom table to text and back without load

Track contents

10 lessons, 2.5 hours in total
  1. 1An event systemLuaSubscribe with on and fire with emit
  2. 2Entities and componentsLuaAn update loop that safely removes the dead
  3. 3The player's inventoryLuaCapped stacks and returning the overflow
  4. 4CooldownsLuaThe canUse, use and remaining functions
  5. 5A state machineLuaClear transitions with enter and exit hooks
  6. 6A coroutine schedulerLuaPause with yield and continue with resume
  7. 7Vectors with metatablesLuaWrite pos + vel * dt just like in math
  8. 8Collision detectionLuaRectangles, circles and shapes that only touch
  9. 9Calculating damageLuaArmor, critical hits and dying only once
  10. 10Saving and loading the gameLuaFrom table to text and back without load