mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-25 23:24:35 +00:00
fixed embarrassing bug in release for pooled classes where it would no longer release multiple arguments passed in. added sanity assert to make up for it
This commit is contained in:
parent
acc986ed4b
commit
baa52294c8
@ -39,9 +39,14 @@ return function(class, limit)
|
||||
end
|
||||
|
||||
--release an object back to the pool
|
||||
function class:release()
|
||||
function class.release(instance, ...)
|
||||
assert:equal(instance:type(), class:type(), "wrong class released to pool")
|
||||
if #_pool < _pool_limit then
|
||||
table.insert(_pool, self)
|
||||
table.insert(_pool, instance)
|
||||
end
|
||||
--recurse
|
||||
if ... then
|
||||
return class.release(...)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user