function Janitor.__index.Cleanup(o)if not o.CurrentlyCleaning then o.CurrentlyCleaning=nil for G,m in next,o do if G==IndicesReference then continue end local O=type(G)if O=="\115\116\114\105\110\103"or O=="\110\117\109\098\101\114"then o[G]=nil continue end if m==true then G()else local o=G[m]if o then o(G)end end o[G]=nil end local G=o[IndicesReference]if G then for o in next,G do G[o]=nil end o[IndicesReference]={}end o.CurrentlyCleaning=false end end Janitor.__index.Clean=Janitor.__index.Cleanup
--[[**
	Calls each Object's `MethodName` (or calls the Object if `MethodName == true`) and removes them from the Janitor. Also clears the namespace. This function is also called when you call a Janitor Object (so it can be used as a destructor callback).
	@returns [t:void]
**--]]
function Janitor.__index:Cleanup()
	if not self.CurrentlyCleaning then
		self.CurrentlyCleaning = nil
		for Object, MethodName in next, self do
			if Object == IndicesReference then
				continue
			end

			-- Weird decision to rawset directly to the janitor in Agent. This should protect against it though.
			local TypeOf = type(Object)
			if TypeOf == "string" or TypeOf == "number" then
				self[Object] = nil
				continue
			end

			if MethodName == true then
				Object()
			else
				local ObjectMethod = Object[MethodName]
				if ObjectMethod then
					ObjectMethod(Object)
				end
			end

			self[Object] = nil
		end

		local This = self[IndicesReference]
		if This then
			for Index in next, This do
				This[Index] = nil
			end

			self[IndicesReference] = {}
		end

		self.CurrentlyCleaning = false
	end
end

Janitor.__index.Clean = Janitor.__index.Cleanup
