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:
Max Cahill 2024-11-22 11:18:52 +11:00
parent acc986ed4b
commit baa52294c8

View File

@ -39,9 +39,14 @@ return function(class, limit)
end end
--release an object back to the pool --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 if #_pool < _pool_limit then
table.insert(_pool, self) table.insert(_pool, instance)
end
--recurse
if ... then
return class.release(...)
end end
end end
end end