View Full Version : a easy question about maya MEl
koalaLoon 07-11-2009, 04:16 PM there is a sentence about strings i don't understand very well in the maya help document.
it says In mel scripts do not split strings across lines without using a line continuation character"\"
my first language is not English, and i just started learning mel,so...please someone explain it for me, a example will be appreciated.
thanks!
|
|
GuismoW
07-11-2009, 05:47 PM
Hi,
This means that if you wanna write a string on several lines you must use the '\' character at the end of each lines. This will tell maya that your string uses several lines.
eg : string $str1 = "sentense on one line";
string $str2 = "the first line\
the second line\
\
etc\";
This is useful when you have to write "mel script" as string. You can see that if you try to create windows
window;
columnLayout;
button -label "Click on me" -command "print \"Hello, \";\
print \"my name Victor, \"; \
print \"I'm trying sthg...\"; \
";
setParent..;
showWindow;
this form is compulsory when you want to use the 'scriptNode' command for instance
enjoy
GennadiyKorol
07-11-2009, 06:40 PM
It means you can't split a string among 2 lines of the script, like this:
string $str = "first part of this line
second part on this line"
instead you should use the \ character,
string $str = "first part of this line \
second part on this line"
This then works.
koalaLoon
07-12-2009, 06:26 AM
i understand it now,thank you both!
CGTalk Moderation
07-12-2009, 06:26 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.