--[[
	Converts a yielding function into a Promise-returning one.
]]

function Promise.promisify(callback, selfValue)
	return function(...)
		local length, values = pack(...)
		return Promise.async(function(resolve)
			if selfValue == nil then
				resolve(callback(unpack(values, 1, length)))
			else
				resolve(callback(selfValue, unpack(values, 1, length)))
			end
		end)
	end
end

function Promise.prototype:getStatus()
	return self._status
end
