mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-03 21:03:54 -04:00
Optimized Lists. Added pool.added and .removed. Added entity:ensure
This commit is contained in:
parent
e2b7af87fd
commit
11255fd722
7 changed files with 104 additions and 48 deletions
|
@ -14,6 +14,9 @@ Pool.__index = Pool
|
|||
function Pool.new(name, filter)
|
||||
local pool = setmetatable(List(), Pool)
|
||||
|
||||
pool.added = {}
|
||||
pool.removed = {}
|
||||
|
||||
pool.name = name
|
||||
pool.filter = filter
|
||||
|
||||
|
@ -22,6 +25,12 @@ function Pool.new(name, filter)
|
|||
return pool
|
||||
end
|
||||
|
||||
function Pool:flush()
|
||||
for i = 1, math.max(#self.added, #self.removed) do
|
||||
self.added[i], self.removed[i] = nil, nil
|
||||
end
|
||||
end
|
||||
|
||||
--- Checks if an Entity is eligible for the Pool.
|
||||
-- @param e The Entity to check
|
||||
-- @return True if the entity is eligible, false otherwise
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue