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 Jun 19, 2010 1:47 am   

[3.20] BUG: %additem( "item", db.key) beginning with null item.
 
I realize I already brought it up in: http://forums.zuggsoft.com/forums/viewtopic.php?t=35322; But, just sticking with the one bug per thread rule and organizing it a bit better.

%additem( "item", db.key) is starting the list with a null item if the key is empty.

code:
Code:
#print {Deleting food.}
#unvar food
#print {Adding key dinner to food with #addkey}
#addkey food dinner
#print {Adding items to food.dinner with ~%additem}
#call %additem( "meat", food.dinner)
#call %additem( "cheese", food.dinner)
#call %additem( "milk", food.dinner)
#print Food: %expand(@food)
#print Json: %json(@food)


Output:
Quote:
Deleting food.
Variable food removed.
Adding key dinner to food with #addkey
Adding items to food.dinner with %additem
Food: dinner="|meat|cheese|milk"
Json: {"dinner":["","meat","cheese","milk"]}
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Jun 19, 2010 3:07 am   
 
How about this? If done this way, it comes out right:
Code:

#echo {Deleting food.}
#unvar food
#var dinner ""
#call %vartype(dinner,4)
#echo {Adding items to dinner with ~%additem}
#call %additem( "meat", dinner)
#call %additem( "cheese", dinner)
#call %additem( "milk", dinner)
#echo {Adding key dinner to food}
food.dinner = @dinner
#echo Dinner = %expand(@dinner)
#echo Json~(Dinner~) = %json(@dinner)
#echo Food: %expand(@food)
#echo Json: %json(@food)


Output:
Code:

Deleting food.
Variable food removed.
Adding items to dinner with %additem
Adding key dinner to food
Dinner = meat|cheese|milk
Json(Dinner) = ["meat","cheese","milk"]
Food: dinner="meat|cheese|milk"
Json: {"dinner":["meat","cheese","milk"]}
_________________
Sic itur ad astra.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sat Jun 19, 2010 4:18 am   
 
Yes, that indeed works. The null item is only when working directly with a key.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 21, 2010 4:23 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