Getting access to the EachIn counter

BlitzMax Forums/BlitzMax Programming/Getting access to the EachIn counter

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Is it possible to get access to and alter the counter value or offset or address or whatever it is, of the EachIn counter?

e.g.

If I do:

For a=EachIn b
Print a
Next a

it's evident that the a object actually points to each instance of the b objects, for each loop iteration. So a isn't a loopcounter, it's an actual object.

So the loopcounter is `hidden` and handled behind the scenes. So with that in mind, it isn't possible to do a=5 to jump to offset 5 (ie to backtrack and force the loop to rewind and then continue counting).

You can do:

For a=0 to 9
Print b[a]
If KeyHit(KEY_ESCAPE) Then a=5
Next

but you can't do

For a=EachIn b
print a
If KeyHit(KEY_ESCAPE) Then EachIn=5
Next

Of course that's not correct syntax. Is there any way to access and modify that counter or is it so hardwired that it's not flexible? I'd like to use the extra speed possibly with EachIn but still modify which object the loop is currently at.