I am so sorry. Do you thing that my programing is bad? It is maybe true, but I love itSpiderFighter wrote:Damn. That code made my head hurt.
I dont know how get value from graph in lua easily.
Edit:
I have idea to rewrite script to be much much simple. I will do it during weekend.
Edit:
This is little bit optimalized code :
Code: Select all
function GetTableFromRamp(ramp,poc)
local tab={}
local A,B,y
local increment = 100.0 / poc
local index = 2
for j = 1, poc do
position = 1.0*j*increment
while (position > ramp[index].x) and (index < #ramp) do
index = index +1
end
A = ramp[index-1]
B = ramp[index]
y = (1.0*(position-A.x)/(B.x-A.x)*(B.y-A.y)+A.y)/100.0
tab[j]={["x"]=position,["y"]=y}
end
return tab
end



