Page 1 of 1
String as parameters
Posted: Mon Oct 05, 2015 2:26 pm
by enric
If I remember well in BA1 there was no possible to use strings as parameter in mod functions, right?
Because this :
PlayTest("hello");
FUNCTION PlayTest(myString)
{
Log ("myString", myString);
}
prints 934237349
Is there a way I missed to pass strings as parameters in BA2?
Re: String as parameters
Posted: Mon Oct 05, 2015 3:22 pm
by pipfromslitherine
I THINK it will work if you pass it into a function which expects a string (Log doesn't, but something like PrintWorkLiteral would).
Cheers
Pip
Re: String as parameters
Posted: Mon Oct 05, 2015 3:22 pm
by pipfromslitherine
I THINK it will work if you pass it into a function which expects a string (Log doesn't, but something like PrintWorkLiteral would).
Cheers
Pip
Re: String as parameters
Posted: Mon Oct 05, 2015 4:21 pm
by enric
PrintWorkLiteral doesn't exist.
// PrintStringLiteral(myString);
// PrintString(myString);
// PrintWorkStringLiteral(myString);
Don't work, but the string is received because StringCompare works.
if ( StringCompare(myString, "hello") == 1)
{
Log("it works");
}
else
{
Log("it doesn't");
}
Re: String as parameters
Posted: Mon Oct 05, 2015 9:18 pm
by pipfromslitherine
I would expect PrintStringLiteral to work if StringCompare works. But nothing gets 'done' to the 'string' value as it passed through functions, so it should be able to be passed to any function which takes a string.
Cheers
Pip