Seems simple enough, but at the end of the loop all the elements of the array are the same, even though they are not calculated that way..
Here is an example that will produce the issue
Code: Select all
rows := [[]]
Loop 8 {
rows[%A_Index%] := [ 30, 50 + ( 1000 / 8 * (A_Index-1) ), 150, 45 ]
MsgBox, % " x: " rows[%A_Index%][1] " y: " rows[%A_Index%][2] " w: " rows[%A_Index%][3] " h: " rows[%A_Index%][4]
}
Loop 8 {
MsgBox, % " x: " rows[%A_Index%][1] " y: " rows[%A_Index%][2] " w: " rows[%A_Index%][3] " h: " rows[%A_Index%][4]
}
The second series of MsgBoxs' will each show the same number for " y: " , why?
The "y" (2nd item) of each row ends up being the same for all row indices, even though to me it seems like they should differ as printed by the first MsgBox series
What could I do to properly store calculations into an Array?