A Simple Game Animation

With these preliminaries out of the way, we’re ready to tackle an actual problem that a typical Lua hacker might face. Lua is often used as a scripting language for games. These days, games often include particle systems that generate organic-looking graphical effects. I’ve always wanted to build a particle emitter, so today I’m going to start a fire, functional style!

A functional particle system wouldn’t retain mutable state, so it might be a function that accepts state (particles) as an argument and produces new state (new particles).

But before I can start writing my particle system, I need something capable of drawing. I was without my computer this weekend, so that gave me an excuse to use Codea,[34] a cute ...

Get Functional Programming: A PragPub Anthology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.