local D={}D.__index=D function D.doCleaning(D)for D,p in ipairs(D.data)do local n=typeof(p)if n=="\073\110\115\116\097\110\099\101"then p:Destroy()elseif n=="\082\066\088\083\099\114\105\112\116\067\111\110\110\101\099\116\105\111\110"then p:Disconnect()else p:destroy()end end end function D.giveTask(p,D)p.data[#p.data+1]=D end function D.new()local p={}setmetatable(p,D)p.data={}return p end return D
-- OptimisticSide
-- 5/7/2021
-- Garbage collector (similar to Quenty's Maid)

local Maid = {}
Maid.__index = Maid

-- Destroy any objects given prior.
function Maid:doCleaning()
	for _, object in ipairs(self.data) do
		local objectType = typeof(object)

		if objectType == "Instance" then
			object:Destroy()
		elseif objectType == "RBXScriptConnection" then
			object:Disconnect()
		else
			-- Assume this is a custom object
			-- given to maid for a reason.
			object:destroy()
		end
	end
end

-- Give maid an object to
-- be removed upon cleaning.
function Maid:giveTask(object)
	self.data[#self.data+1] = object
end

-- Create a maid object.
function Maid.new()
	local self = {}
	setmetatable(self, Maid)

	self.data = {}
	return self
end

return Maid
