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
The Raven
Magician


Joined: 13 Oct 2000
Posts: 463

PostPosted: Fri Aug 17, 2007 6:14 pm   

[1.34] #VAR $var {...} broken; cannot create variables named with $vars.
 
#ALIAS working {
var = "Foo"
#VAR @var {Bar}
#ECHO @Foo
}

The output of running this is, as expected, 'Bar'. The @Foo variable is created (as is the useless @var variable)

Now, the smart programmer would try to take advantage of the new temporary variables to streamline the code:

#ALIAS broken {
$var = "Foo"
#VAR $var {Bar}
#ECHO @Foo
}

Not so good. The output is a blank line, because the @Foo variable is not created. In fact, #VAR tries to create a variable with a blank name.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Aug 17, 2007 6:30 pm   
 
Not a bug - the #var command can also be used to directly edit the values of local variables. To edit a variable named dynamically with a local variable, use

#var %eval($local) {value}

as in

$test=olol;#var %eval($test) {wow};#say @olol

I guess this is another thing that needs adding to the help.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
The Raven
Magician


Joined: 13 Oct 2000
Posts: 463

PostPosted: Fri Aug 17, 2007 7:33 pm   
 
Ahh, gotit. Thank you.
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