mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-21 21:54:35 +00:00
slightly refactored make_pooled
This commit is contained in:
parent
bde95f208f
commit
207b4ddf4d
@ -30,10 +30,10 @@ return function(class, limit)
|
||||
--get a pooled object
|
||||
--(re-initialised with new, or freshly constructed if the pool was empty)
|
||||
function class:pooled(...)
|
||||
if #_pool == 0 then
|
||||
local instance = class:drain_pool()
|
||||
if not instance then
|
||||
return class(...)
|
||||
end
|
||||
local instance = class:drain_pool()
|
||||
instance:new(...)
|
||||
return instance
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user