|
emnaki Wanderer
Joined: 12 May 2007 Posts: 59
|
Posted: Thu Dec 20, 2007 4:43 am
[2.18] %replaceitem bug |
Code: |
#ECHO @aflist
#LOOP 1,%numitems(@aflist) {$tmp = %eval(%item(@aflist,%i)-%1);#SAY %i;#VAR aflist %replaceitem($tmp,%i,@aflist)}
#ECHO @aflist |
output:
Code: |
8|-|24
1
2
3
6|-|24|22
6|-|24|22
1
2
3
4
5|-|23|22|21
5|-|23|22|21
1
2
3
4
5
3|-|21|20|21|19
|
As can be seen from the above output of the echos, %replaceitem does the replace at the end of the list incorrectly, it adds an item to the end of the list instead of replacing the last item. The problem persists if I use numbers instead of the %numitems function. A hack fix I did was to add a dummy item to the list end and only iterate to %numitem -1. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 07, 2008 9:55 pm |
Added to bug list.
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|