List Variable in a For Loop


#1

This might not be restricted to this particular circumstance, but when a list variable is used in a For Loop, a reference to the 10th item in the list fails and actually refers to the 1st item in the list. If this description doesn’t make sense, run the attached example. After it has been run via the Test button, look at the new_string variable. The 10th, 20th, and 30th data point are incorrect.

Can’t tell you how frustrated with one of my piston I was until I found this error and reproduced it here. The problem may exist in other circumstances and list data points, but hopefully the example is enough to locate the bug.


#2

likely the issue is with using $index, which is a decimal, as the index. define and use an integer as the index and everything should be ok.


#3

Ah, I did try replacing $index at some point and saw some variation in the result. Tweaking the example, I can see that using an integer for the loop does resolve the issue.

Regardless, this seems like an issue that should be an addressed given that most users are going to default to $index as a counter. But that’s just my $0.02 …


#4

It should work with $index - I’ll look into it when I have the time - ping me back here if I don’t get this fixed by end of weekend please.


#5

ping :grinning:


#6

@ady624 Still an issue in v0.2.0fb.20171026


#7

pong - forgot about this, next time :wink: sorry