function Promise.promisify(Y,Q)return function(...)local J,p=pack(...)return Promise.async(function(H)if Q==nil then H(Y(unpack(p,1,J)))else H(Y(Q,unpack(p,1,J)))end end)end end function Promise.prototype.getStatus(Y)return Y._status end

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
