You can do shorter
for i = 1, whatever_you_want do
if i < 15 then
-- calculation
elseif i < 30 then
-- other calculation
elseif i < 45
-- Again
end
end
This is recommanded to do so if you plan to do exponential coordination, for instance, admit that i[0; 15] have a fixed position of x + 15 where x = 10 (example)
simple way is
if i <= 15 then
table:draw(surface, 10 + (15 * i))
elseif i <= 30 then
-- Other position
table:draw(surface, 24 + (13 * i))
end
And it does the job
In the case of your example
local starter={}
local ender ={}
for i = 1, 15 do
-- First, check if i = 1, if yes, then the start value would be 0
local start = i == 1 and 0 or starter[i]
-- starter and ender share the same result apparently ?
starter[i] = start + 15
ender[i] = starter[i]
end
Now let's assume you want to increment the starter and ender array in a different way, but still exponentially
local starter={}
local ender ={}
for i = 1, 30 do
-- First, check if i = 1, if yes, then the start value would be 0
local start = i == 1 and 0 or starter[i]
local increment
if i <= 15 then
increment = 15
elseif i <= 30 then
increment = -30
end
-- starter and ender share the same result apparently ?
starter[i] = start + increment
ender[i] = starter[i]
end
Not tested but that should work