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
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 16, 2010 2:02 pm   

[3.19e] variable not converted FIXED
 
In 3.17, I make the followin variable:
Code:

<var name="test1" type="Record" id="298">test="""a|b|c""|""alpha|beta|gamma""|""aleph|beth|gimel"""</var>

Testing it:
Code:

#show %db(@test1,"test")
#show %item(%db(@test1,"test"),1)
#show %item(%item(%db(@test1,"test"),1),1)

Shows:
Code:

"a|b|c"|"alpha|beta|gamma"|"aleph|beth|gimel"
a|b|c
a

Unfortunately, this variable does not translate to json properly. In 3.19e it is converted as:
Code:

  <var name="test1" type="Record" id="298">
    <value>test="a|b|c""|""alpha|beta|gamma""|""aleph|beth|gimel"</value>
    <json>{"test":"a|b|c\"|\"alpha|beta|gamma\"|\"aleph|beth|gimel"}</json>
  </var>

And the three #show commands above give:
Code:

a|b|c"|"alpha|beta|gamma"|"aleph|beth|gimel
a|b|c"|"alpha|beta|gamma"|"aleph|beth|gimel
a|b|c"|"alpha|beta|gamma"|"aleph|beth|gimel


Last edited by Rahab on Thu Jun 17, 2010 1:24 pm; edited 1 time in total
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jun 16, 2010 4:52 pm   
 
Can you tell me more about how the variable was originally created in v3.17? I'll take a look at the import code in 3.19 to see what I can learn.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 16, 2010 7:39 pm   
 
I believe this specific test was created by something like this:
Code:

#additem $item {a|b|c}
#additem $item {alpha|beta|gamma}
#additem $item {aleph|beth|gimel}
#addkey test1 test $item

But I some of my 3.17 scripts have also done it more directly, something like:
Code:

...
$next = "alpha|beta|gamma"
$current = %db(@test1,"test")
#if (!%ismember($next,$current,) {
  #addkey @test1 "test" %additem($next,$current)
}

each time I needed to add a new sub-stringlist. I recognized when I wrote this that I was pushing the limits of what was possible under the code at that time. But it did work for my purposes, as I was able to access each element with the appropriate set of %item() and %db() functions. I expect to completely rewrite my code once the json tables are sufficiently stable.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Jun 16, 2010 7:46 pm   [3.19e] Nested stringlists as value of db variable not converted properly
 
As a sidenote, I suspect almost no one else has tried to do what I did above, so this may not be worth fixing if it doesn't affect anything else. I'm certain I can write some code to convert the handful of variables I have like this, and once converted it should be fine. What I'm not sure of is how the old-style portion of a 3.19 variable with this kind of layering would look, and whether it would continue to cause problems for variables like this.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Jun 17, 2010 1:24 pm   
 
Looks like this is fixed nicely.
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