local k={}if _Tune.CacheTorque then for w,u in pairs(_Tune.Ratios)do local R={}for k=math.floor(_Tune.IdleRPM/_Tune.CacheRPMInc),math.ceil((_Tune.Redline+100)/_Tune.CacheRPMInc),1 do local u={}u.Horsepower,u.Torque=GetCurve(k*_Tune.CacheRPMInc,w-2)hp1,tq1=GetCurve((k+1)*_Tune.CacheRPMInc,w-2)u.HpSlope=(hp1-u.Horsepower)/(_Tune.CacheRPMInc/1000)u.TqSlope=(tq1-u.Torque)/(_Tune.CacheRPMInc/1000)R[k]=u end table.insert(k,R)end end
--Output Cache
local HPCache = {}

if _Tune.CacheTorque then
	for gear, ratio in pairs(_Tune.Ratios) do
		local hpPlot = {}
		for rpm = math.floor(_Tune.IdleRPM / _Tune.CacheRPMInc), math.ceil((_Tune.Redline + 100) / _Tune.CacheRPMInc) do
			local tqPlot = {}
			tqPlot.Horsepower, tqPlot.Torque = GetCurve(rpm * _Tune.CacheRPMInc, gear - 2)
			hp1, tq1 = GetCurve((rpm + 1) * _Tune.CacheRPMInc, gear - 2)
			tqPlot.HpSlope = (hp1 - tqPlot.Horsepower) / (_Tune.CacheRPMInc / 1000)
			tqPlot.TqSlope = (tq1 - tqPlot.Torque) / (_Tune.CacheRPMInc / 1000)
			hpPlot[rpm] = tqPlot
		end
		table.insert(HPCache, hpPlot)
	end
end
