Collection
ceramic.Collection (Abstract)
A type-safe collection for managing CollectionEntry items.
Collection provides an efficient way to store and access items by ID, with support for:
- Fast lookup by string ID
- Array-like indexing
- Iteration support
- Random element selection
- Collection combining and filtering
Collections are particularly useful for managing game entities that need to be accessed both by ID and by index.
Example usage:
var enemies = new Collection<Enemy>();
enemies.push(new Enemy("goblin1"));
enemies.push(new Enemy("goblin2"));
// Access by ID
var goblin = enemies.get("goblin1");
// Access by index
var firstEnemy = enemies[0];
// Iterate
for (enemy in enemies) {
enemy.update();
}
Metadata
Name | Parameters |
---|---|
:forward |
- |
:keepSub |
- |