Builtin Library
README.md
Particles.spawnBatches
The spawn batches a particle emitter keeps, as a min-heap on the clock each batch leaves the live bound at, and the count of particles they can still hold alive. An entry whose slots a whole capacity of later placements has overwritten holds no particle, and a sweep drops it, so the heap stays within twice the emitter's capacity whatever the particles' lifetime.
newSpawnBatches()answers an empty heap.pushBatch(b, leavesAt, count, capacity)files a batch ofcountparticles, the last of which leaves the bound atleavesAt, into an emitter ofcapacityslots.batchesHeldAt(b, now)drops every entry whose clock is at or behindnowand answers how many particles the rest placed.forgetBatches(b)forgets every batch.
local Batches = require("@builtin::deprecated.deprecatedParticles.engine.spawnBatches")
local b = Batches.newSpawnBatches()
Batches.pushBatch(b, 2.0, 10, 100)
print(Batches.batchesHeldAt(b, 1.0)) -- 10
print(Batches.batchesHeldAt(b, 3.0)) -- 0