eval evaluates the string given as UniScript code.
Return Value
The function does not have a return value. Instead it will create an exception if an error occurs. The exception can be caught withe the try/except statement. See also evalp.
Parameters
ssString is a string with UniScript code (Statements and or functions).
Example
eval("a = 1+1");
print a;
If eval is used inside a function all variables used in the eval function are local variables. If eval needs to access variables from the calling function they mus be declared as global.
def test(rvData, ssOperator, ssLimit)
{
global data, i;
data = rvData;
ssString = sprintf("i = find(data %s %s)", ssOperator, ssLimit);
eval(ssString);
return i;
}
idx = test([1,2,3,4,5,6,7], "<=", "4.5")
if (idx[1] == 0) {
MessageBoxError("No data found");
}
print idx // prints 1,2,3,4
See also
id-944627