Module pool
Pool A Pool is used to iterate over Entities with a specific Components A Pool contain a any amount of Entities.
Functions
Pool.new (name, filter) | Creates a new Pool |
Pool:__eligible (e) | Checks if an Entity is eligible for the Pool. |
Pool:__add (e) | Internal: Adds an Entity to the Pool. |
Pool:__remove (e) | Internal: Removed an Entity from the Pool. |
Pool:getName () | Gets the name of the Pool |
Pool:getFilter () | Gets the filter of the Pool. |
Pool:onEntityAdded (e) | Callback for when an Entity is added to the Pool. |
Functions
- Pool.new (name, filter)
-
Creates a new Pool
Parameters:
- name Name for the Pool.
- filter Table containing the required BaseComponents
Returns:
-
The new Pool
- Pool:__eligible (e)
-
Checks if an Entity is eligible for the Pool.
Parameters:
- e Entity to check
Returns:
-
True if the entity is eligible, false otherwise
- Pool:__add (e)
-
Internal: Adds an Entity to the Pool.
Parameters:
- e Entity to add
Returns:
-
self
- Pool:__remove (e)
-
Internal: Removed an Entity from the Pool.
Parameters:
- e Entity to remove
Returns:
-
self
- Pool:getName ()
-
Gets the name of the Pool
Returns:
-
Name of the Pool.
- Pool:getFilter ()
-
Gets the filter of the Pool.
Warning: Do not modify this filter.
Returns:
-
Filter of the Pool.
- Pool:onEntityAdded (e)
-
Callback for when an Entity is added to the Pool.
Parameters:
- e Entity that was added.