Strings With Hyfens?
by David Taylor · in Torque Game Builder · 09/14/2007 (5:19 am) · 4 replies
I'm using the gui to call a function that echoes a string I pass to it, once the user clicks on a button - (guiBitmapButtonCtrl). But if I pass two words connected with a hyfen, (-), it tries to subtract the two words and echoes the number 0. I tried replacing the - with a ~ but got the same result.
So just to clarify, if I code this:
echo(Apples-Oranges);
it echoes this:
0
instead of:
Apples-Oranges
Does anyone know a way to get around this?
So just to clarify, if I code this:
echo(Apples-Oranges);
it echoes this:
0
instead of:
Apples-Oranges
Does anyone know a way to get around this?
About the author
#2
09/14/2007 (6:17 am)
Unfortunately not. It just returns a parse error...?
#3
It's probably the way you're using the strings in your own code, could you post a snippet? If you're using your strings inside othe strings, try protecting your quotes with a bacskslash. Use (\") instead of ("). So if youre using a function call from the Command property of your button, it would read like this:
Command="MyFunction(\"MyString\");";
Hope this helps.
09/14/2007 (6:53 am)
Well echo("Apples-Oranges") does echo Apples-Oranges in the console for me.It's probably the way you're using the strings in your own code, could you post a snippet? If you're using your strings inside othe strings, try protecting your quotes with a bacskslash. Use (\") instead of ("). So if youre using a function call from the Command property of your button, it would read like this:
Command="MyFunction(\"MyString\");";
Hope this helps.
#4
09/14/2007 (6:59 am)
That did the trick! It works perfectly! Thanks so much! :)
Torque 3D Owner Maxime Jouin
Default Studio Name
echo("Apples-Oranges")