spawn — Luau Binding

require("spawn"): pre-allocated pools of targets, borrowed and returned without allocation churn. The programmatic surface of the spawn system. Every function is [antos].

Status: design. Not built yet.

local spawn = require("spawn")
Call Returns Does
spawn.pool(kind, size, init?) pool pre-allocate a pool of size targets of kind; init seeds each one's defaults
spawn.get(pool, opts?) target borrow a live target from the pool (position, etc. in opts); nil if exhausted and the policy is refuse
spawn.despawn(target) ok reset the target and return it to its pool — removes it from every sibling at once
spawn.alive(pool) number how many of the pool are currently live
spawn.policy(pool, how) ok over-capacity behaviour — "recycle-oldest" or "refuse"
local spawn = require("spawn")
local bullets = spawn.pool("bullet", 128)

local b = spawn.get(bullets, { x = gun.x, y = gun.y })
motion.play(b, "FD 2000")
collision.on("enter", function(a, hit) if a == b then spawn.despawn(b) end end)

Where to go next

  • Pools, lifecycle, despawn triggers → spawn · the registry → stage · the big user → particles

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.