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 Jul 03, 2010 9:34 pm   

[3.22] BUG? #addkey 1 2 3 fails.
 
#addkey doesn't accept numbers, even in quotes, for variable names.

Examples:
Code:
#addkey 1 2 3
#addkey "1" "2" "3"
#addkey "1" "two" "three"
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Jul 03, 2010 11:54 pm   
 
A variable name can not begin with a number or an '_'. There are few others I believe, you special chars etc.
_________________
Asati di tempari!
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jul 04, 2010 12:02 am   
 
Variable names most certainly can begin with an _, though I don't think it's really advised. As far as numbers go, Tech is correct about that. Especially now with the "by reference" option, you don't want to do something like: #CALL %additem(1, test) and have it send the variable 1 to test instead of the number 1.

Charneus
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Sun Jul 04, 2010 1:45 am   
 
Mmm, I guess I wasn't aware of this. I certainly knew you couldn't use numbers as the names of aliases.

Also, Char, wouldn't only the 2nd argument in %additem ever be a variable reference?
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sun Jul 04, 2010 1:49 am   
 
Good point, GS. Hadn't thought about that.

I remember bringing up the use of numbers as aliases, though, which screwed up scripts because %eval no longer worked. If I had an alias of 1, %eval(10-1) would return nothing. Oh well.

CHarneus
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Jul 06, 2010 5:04 pm   
 
You definitely should not use numbers for variable names.
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