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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat Oct 20, 2007 7:29 am   

[2.07] #forall nested in #loopdb, unexpected results
 
Alright, so I wasn't sure weither this was a bug, or just my own lack of understanding. Since I'm at a lack of words to explaining exactly what is happening I will give an example:

The alias:

Code:

#echo Entering db1 loop
#loopdb @db1 {
  #echo %null
  #echo Key: %key Val: %val
  #echo %null
  #echo Entering list1 loop
  #forall @list1 {
    #echo Key: %key Val: %val i: %i
  }
  #echo Exited list1 loop
}
#echo Exited db1 loop


The variables:

Code:
 <var name="db1" type="Record" id="4">key1=dbval1|key2=dbval2|key3=dbval3</var>
 <var name="list1" type="StringList" id="5">listitem1|listitem2</var>


The results:

Code:

Entering db1 loop

Key: key2 Val: dbval1

Entering list1 loop
Key: listitem1 Val: key2 i: dbval1
Key: listitem2 Val: key2 i: dbval1
Exited list1 loop

Key: key3 Val: dbval2

Entering list1 loop
Key: listitem1 Val: key3 i: dbval2
Key: listitem2 Val: key3 i: dbval2
Exited list1 loop

Key: key1 Val: dbval3

Entering list1 loop
Key: listitem1 Val: key1 i: dbval3
Key: listitem2 Val: key1 i: dbval3
Exited list1 loop
Exited db1 loop


So while in the forall loop, from what I can tell, %val is what %key should be, %i is what %val should be, and %key is what %i should be. Is this a known bug or is there something I'm missing?


Last edited by GeneralStonewall on Sat Oct 20, 2007 9:00 pm; edited 1 time in total
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sat Oct 20, 2007 2:35 pm   
 
Looking at the @db1 and @list1 with the Package Editor, do they look correct?

What version of CMUD? If it's 1.34, it might be worth trying again with 2.06 Beta in case it's a bug that's been fixed.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat Oct 20, 2007 7:09 pm   
 
This was actually with 2.07 in brand new settings. I just noticed as well that it looped through the database in the wrong order with the keys not matching with the values. Here are the variables:

Code:
 <var name="db1" type="Record" id="4">key1=dbval1|key2=dbval2|key3=dbval3</var>
 <var name="list1" type="StringList" id="5">listitem1|listitem2</var>


I'll go try running it on the 2.06 and 1.34 now. Since this was with 2.07 this thread might want to be moved to the beta forums, didn't think about that before.

Edit:

It appears to be a bug in 2.07 as it works as expected in 1.34:

Code:
Entering db1 loop

Key: key1 Val: dbval1

Entering list1 loop
Key: key1 Val: dbval1 i: listitem1
Key: key1 Val: dbval1 i: listitem2
Key: key1 Val: dbval1 i: listitem3
Exited list1 loop

Key: key2 Val: dbval2

Entering list1 loop
Key: key2 Val: dbval2 i: listitem1
Key: key2 Val: dbval2 i: listitem2
Key: key2 Val: dbval2 i: listitem3
Exited list1 loop

Key: key3 Val: dbval3

Entering list1 loop
Key: key3 Val: dbval3 i: listitem1
Key: key3 Val: dbval3 i: listitem2
Key: key3 Val: dbval3 i: listitem3
Exited list1 loop
Exited db1 loop
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Oct 22, 2007 7:54 pm   
 
Confirmed and added to bug list.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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