Problem using parameters in functions

I’m using the following parameters defined in an external file:
MIN=10
DIR=C\:/workspace

When I try using them in a function the ${MIN} parameter works as expected, but ${DIR} produces an error of “Encountered “:” at line 4, column 16”. How can I use string parameters correctly?

Also, could you point me to an example of eval() function usage? Can’t find a working one anywhere.

Thanks.

Hello,
parameters are just replaced by theirs values, so when you use parameter as string you have to quote it:

integer min = ${MIN};
string dir = "${DIR}";

is evaluated as:


integer min = 10;
string dir = "C\:/workspace";

while

integer min = ${MIN};
string dir = ${DIR};

is evaluated as:


integer min = 10;
string dir = C\:/workspace;

what (properly) leads to parse error.

eval function proved to be useless, so it has been removed from ctl2.

Thanks.

Just curious, in this example would you need to resort to something like “${” + “DIR}” to output a string of “${DIR}” so it wouldn’t be replaced by the parameter value?

Yes, the only way to get string like ${param} for existing param is to split it into two strings :slight_smile: