function MapRange(s, a1, a2, b1, b2) return b1+(s-a1)*(b2-b1)/(a2-a1) end function for i = 0 to 10 print i; " maps to "; MapRange(i,0,10,-1,0) next i end