About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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: Fri Jun 11, 2010 2:38 am   

[3.19] BUG: Switching variable from list to database var
 
Possibly related to http://forums.zuggsoft.com/forums/viewtopic.php?t=35260

Changing from treating a variable as a string list to a database variable has some unexpected results:

First example:
Code:
testvar = %null
#additem testvar cheese
#additem testvar test
#addkey testvar 1 2
#showdb @testvar


output:
Quote:
null
1: 2


Second example:
Code:
testvar = %null
#additem testvar cheese
#additem testvar test
#addkey testvar blah bleh
#addkey testvar 1 2
#showdb @testvar


output:
Quote:
1: 2
1: 2
blah: bleh


In both cases the items 'test' and 'cheese' disappear. Additionally, in the first case a null key is made; While in the second case, a duplicate key is made.
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jun 11, 2010 4:51 pm   
 
First, it looks like there is a problem with #SHOWDB not working properly, so that will effect all of your testing.

The more reliable way to look at the underlying table is using the %json function or doing a #VAR command to see the json table output.

In the first example, the actual json table created is: {"2":"test","1":2}, which is actually correct. Here is what is happening:

#additem testvar cheese
#additem testvar test

creates a list of ["cheese","test"]. @testvar.1 is "cheese" and @testvar.2 is "test. Now, when you use #addkey, the string list is converted to a database variable. To ensure that @testvar.1 and @testvar.2 still return the proper values, the database variable uses the index in the stringlist as the key. So converting this stringlist to a database variable gives:

{"2":"test","1":"cheese"}

and now you do
#addkey testvar 1 2

which ends up replacing the value of key "1" with "2", so "cheese" is replaced by "2".

In your second example, I get the json table of: {"2":"test","1":2,"blah":"bleh"} which is also correct. Again, #SHOWDB doesn't work properly. Although my output from #SHOWDB is

null
1: 2
blah: bleh

which is different from what you showed for some reason.

In summary, except for #SHOWDB not working, the rest of the results are working as expected.
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jun 11, 2010 5:02 pm   
 
Hmm, it's not just #SHOWDB. When I do a #VAR in the first case, it shows "|1=2" for the main record value, which matches the output of #SHOWDB. But the json value is correct. So there is a disconnect between the internal json table and the string value. That indicates a more serious low-level problem. Still trying to track it down.

Since all of my test scripts use the %json function, this probably means there are a lot more problems with 3.19 than I think at this point.
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