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:04 am   

[3.19d] Interesting feature I didn't expect
 
Code:

#addkey test1 alpha {x=1|y=2|z=3}
#show @test1
#show %expanddb(@test2.alpha,";")
#show %expandlist(@test2.alpha,";")

%expanddb() nicely handles a nested list. What I didn't expect was that %expandlist() would also do something nice--formatting a list of just the values. I never tried %expandlist() on a db variable under old versions, so I don't know whether it's always done that. But I suspect that it's a side-effect of the json tables. I like it.

If %expandlist() worked like this on db variables in old versions, just consider this a confirmation that it works on nested lists.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Wed Jun 16, 2010 2:11 am   
 
Zugg definitely made some changes to both of them. I believe it's somewhere in the version histories. Btw, 3.19e is out.
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Jun 16, 2010 2:12 am   
 
You have a typo in your script above ;) I'm assuming you mean @test1.alpha in your last two lines?

Yes, this is a change in how lists work on database variables. In the past, if you fetched the item of a database variable, you would get "key=value". With the new tables, you only get the "value" and not the key.

Some people will like it and some people will hate it. Glad somebody likes it. Returning "key=value" just seemed kludgy to me and just didn't work like other languages with associative arrays.
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