On Dienstag, Aug 19, 2003, at 10:21 Europe/Zurich, Jan Schenkel wrote:


...
on mouseUp

   put ".ds_store" & return & "Help File 1.xml" &
return & "Help File
3.xml" into fileList

put 1 into i

   breakpoint
   repeat for each line currLine in fileList
     delete line i of fileList
     add 1 to i
   end repeat

end mouseUp
...
...
The reason why you are getting such 'strange' results
is that in a repeat for each loop, the engine
remembers where the current line ended, and that's
where it starts looking for the next lineDelimiter.
So in this case, it finds the first line delimiter at
position 9. Then you delete the first line, but the
next repeat loop starts looking at position 10 in the
changed variable. The next lineDelimiter is at new
position 16, so it thinks that line 2 stretches from
position 10 to 16 -- which explains why it gives you "
1.xml" the next time around.
Etcetera, etcetera.

As you shouldn't tinker with the variable you're
interating over, here are a few alternative approaches
to your goal :
...

Eh? I always thought that the repeat for each loop copies the content it loops over and then uses that too loop. This is so that looping in fields is not slower then looping in a variable. In fact looping a variable IS NOT faster then looping a field (I tested that). Unfortunately the fact is that deleting lines in a fashion as the above WILL result in rubbish. I am kinda lost, shouldn't the one fact contradict the other????


_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to