I realised that it was passing the wrong number, thanks, but the bug is still there.
I can't really upload a "small executable" because A) This is the only place in the entire program where the bug occurs, and B) This is part of a piece of coursework and I'd really like it to not be on the web in entirety.
More info:
mainlist[whatever].GetID is used in other places and returns the real values just fine there. However, I have an identical procedure using a different list, and it experiences the same problem
It's not a bug with the IntToStr , since
if( mainlist[x].getID>1000)then
showmessage('Very bad!');
triggers the condition,
when IntToStr(x) is returned, x is exactly what it should be
and it's not to do with the For loop, since the same issue occurs after changing it to a Repeat Until loop
Index | mainlist[index].getID |
0 | 1 |
1 | 2 |
2 | 3 |
3 | 4 |
4 | 5 |
5 | 6 |
6 | 7 |
7 | 8 |
8 | 9 |
9 | 11 |
10 | 12 |