Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
emnaki
Wanderer


Joined: 12 May 2007
Posts: 59

PostPosted: 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.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Jan 07, 2008 9:55 pm   
 
Added to bug list.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net