PGRData/Script/matrix/binary/ReaderPool.lua
2024-09-01 22:49:41 +02:00

22 lines
No EOL
370 B
Lua

ReaderPool = ReaderPool or {}
local Reader = require("Binary/Reader")
local pool = {}
function ReaderPool.GetReader()
if #pool <= 0 then
return Reader.New()
else
return table.remove(pool)
end
end
function ReaderPool.ReleaseReader(reader)
reader:Close()
table.insert(pool, reader)
end
function ReaderPool.Clear()
pool = {}
end