--- Internal __newindex metamethod

function Maid:__newindex(i, v)
	local Tasks = self._Tasks
	local Task = Tasks[i]
	if Task or v == nil then -- Clear previous Task
		local Type = typeof(Task)
		local IsTable = Type == "table"
		if Type == "RBXScriptConnection" or IsTable and Task.Disconnect then
			Task:Disconnect()
		elseif Type == "Instance" or IsTable and Task.Destroy then
			Task:Destroy()
		end
	end
	Tasks[i] = v
end

return Maid
