Not sure where to post this, don't think it is a bug but not sure it is really intended. Just felt like posting this so others are aware since it took me a little troubleshooting to figure out. (I try not to use wait anyway so am happy using different events)
In short, if you use wait in a loop you may lose the values of the loopindex and parameters passed through function. I say may because I couldn't tell if my code was working how desired or not so used textbox to monitor—which is how I found this.
capx: https://www.dropbox.com/s/f1pq9ervg9bv8 ... .capx?dl=0
Events:
Result: (left without wait and right with a wait)