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
atpeace
Novice


Joined: 26 Jan 2009
Posts: 32

PostPosted: Mon Jan 26, 2009 1:47 pm   

%pop does not understand stringlists in record variables
 
#NEWVAR Record "" _nodef
#CALL %vartype(Record,5)
#ADDKEY Record StringList "One"
#ADDKEY Record StringList %push("Two",@Record.StringList)
#SHOW %pop(Record.StringList)

Outputs :
StringList

and clears the key in the newly created variable @Record and turns the type to stringlist.

You can workaround using something like the following (within an alias) :
#ADDKEY Mud SendOnPrompt %additem( %1, @Mud.SendOnPrompt)
#IF (@Mud.PromptWaiting) {
#SEND %item( @Mud.SendOnPrompt, 1)
#ADDKEY Mud SendOnPrompt %delnitem( @Mud.SendOnPrompt, 1)
}
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jan 26, 2009 6:04 pm   
 
That is correct and is a limitation of record variables. Record variables are meant to store *string* values and not string lists. The %pop function requires a simple variable name and does not support the "Record.StringList" syntax.

Also, any time you try to store a string list within a record variable, you are losing all of the high-speed hashing in CMUD to make string lists faster. CMUD is forced to convert your string list into a string value, then store it into the record variable, and then rebuild the string list hash table every time you access it. So in general, try to avoid storing string lists within database variables.
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