function Promise.promisify(v,N)return function(...)local u,j=pack(...)return Promise.async(function(a)if N==nil then a(v(unpack(j,1,u)))else a(v(N,unpack(j,1,u)))end end)end end function Promise.prototype.getStatus(v)return v._status end
--[[
	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
