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: Fri Jun 04, 2010 1:44 am   

[3.18c-] BUG: Quotations being stripped in expanded string.
 
This bug is from before 3.18

Quotations within an expanded string {} in a script appear to be treated differently than on the command line.
Code:
#print {Test "1|2"}

From command line:
Quote:
Test "1|2"

From script:
Quote:
Test 1|2
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jun 04, 2010 3:59 am   
 
Yep, confirmed and added to bug list. This is one of those things that I think had a reason a long time ago. Maybe it was just zMUD compatibility. But it doesn't make sense for it to work differently and printing the quotes is what most people would expect. Unless somebody can think of a reason why the quotes should be striped, I'll fix it.
Reply with quote
GeneralStonewall
Magician


Joined: 02 Feb 2004
Posts: 364
Location: USA

PostPosted: Fri Jun 04, 2010 4:05 am   
 
Well,

Code:
var = blah
#print {"@var"}


prints "@var" literally when used in a script. It makes sense if they're stripped because then it's like a literal string within an expanded one; While if they're not stripped then it doesn't make sense for the variable not to be expanded. Perhaps this is the reason you were thinking of.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jun 04, 2010 3:21 pm   
 
But even then, General, it doesn't make sense for it to work differently on the commandline than in a script.
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jun 04, 2010 4:48 pm   
 
Well, yes and no. The "smart command line" assumes that you are normally trying to send stuff to the MUD on the command line, and so it doesn't strip any quotes. Within a script the parser is more strict.

Looking back into this, fixing this doesn't cause any errors in my big parser test script. I'm pretty sure the reason for this was for zMUD compatibility since there were lots of " used in zMUD for crazy things.

However, in the spirit of trying to make CMUD better and make more sense, I have "fixed" this for the next version so that people can test it to see if it causes any unwanted side-effects. In this next version, the quotes are *not* striped, both in scripts and on the command line.

Also, in the above example from General, the *correct* way to prevent a variable from expanding within {} is to do this:
Code:
#print {~@var}

So people can use the ~ escape character rather than using quotes if they run into this issue.
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