function Maid.GiveTask(q,Z)assert(Z,"\084\097\115\107 \099\097\110\110\111\116 \098\101 \102\097\108\115\101 \111\114 \110\105\108")local C=#q._tasks+1 q[C]=Z if type(Z)=="\116\097\098\108\101"and(not Z.Destroy and not Promise.Is(Z))then warn("\091\077\097\105\100\046\071\105\118\101\084\097\115\107\093 - \071\097\118\101 \116\097\098\108\101 \116\097\115\107 \119\105\116\104\111\117\116 \046\068\101\115\116\114\111\121\n\n"..debug.traceback())end return C end function Maid.GivePromise(q,Z)assert(Promise.Is(Z),"\069\120\112\101\099\116\101\100 \112\114\111\109\105\115\101")if Z:GetStatus()~=Promise.Status.Started then return Z end local C=Promise.Resolve(Z)local A=q:GiveTask(C)C:Finally(function()q[A]=nil end)return C end
--- Same as indexing, but uses an incremented number as a key.
-- @param task An item to clean
-- @treturn number taskId
function Maid:GiveTask(task)
	assert(task, "Task cannot be false or nil")

	local taskId = (#self._tasks + 1)
	self[taskId] = task

	if type(task) == "table" and not task.Destroy and (not Promise.Is(task)) then
		warn("[Maid.GiveTask] - Gave table task without .Destroy\n\n" .. debug.traceback())
	end

	return taskId
end

function Maid:GivePromise(promise)
	assert(Promise.Is(promise), "Expected promise")
	if promise:GetStatus() ~= Promise.Status.Started then
		return promise
	end
	local newPromise = Promise.Resolve(promise)
	local id = self:GiveTask(newPromise)
	newPromise:Finally(function()
		self[id] = nil
	end)
	return newPromise
end
