I have a general logic problem that I have been unable to wrap my head around, and I am wondering whether any of you brilliant people might have ideas for possible solutions.
Let's say I have a table of straightforward numerical values that reflect the widths of individual columns, like so:
Code: Select all
cWidth = {c1, c2, c3}
- The location of the first line is cWidth[1]
- The location of the second line is cWidth[1] + cWidth[2]
- The location of the third line is cWidth[1] + cWidth[2] + cWidth[3]
My brain has only made it as far as this, before stalling out when I try some "i-1" stuff:
Code: Select all
-- Please assume "verticalLineTop" and "verticalLineBottom" are the top and bottom of the chart
-- "left" is the left border of the chart (i.e., the starting point for the measurements)
for i=1,cWidth in ipairs(cWidth) do
local xPoint = (ALCHEMY INVOLVING i THAT I AM UNABLE TO DETERMINE)
love.graphics.line(left + xPoint, verticalLineTop, left + xPoint, verticalLineBottom)
end