lxp
1
It would be helpful if Val()
could interpret not only hardcoded strings but also variables, making this possible:
$glob:foobar="Hello";
Output($glob:foobar);
Output(Val("$glob:foobar"));
myVar="$glob:" + "foobar";
Output(Val(myVar));
Docs: Val
Jon
2
We'll enable this in the next update.
1 Like
lxp
3
Thanks, that's very practical indeed!
I noticed an oddity: Val()
gets confused when an expression starts with a quote and the second parameter is set to true
.
Enclosing the expression in parentheses helps, but shouldn't this be unnecessary? Or is there a reason for it?
Quick demo:
a = "foo";
b = "bar";
foobar = "Hello";
Output(foobar);
Output(Val("foobar"));
// Output(Val("foobar", true)); // error
Output(Val(("foobar"), true));
Output(Val(a + b, true));
Output(Val(a + "bar", true));
// Output(Val("foo" + b, true)); // error
Output(Val(("foo" + b), true));
Output("---");
Jon
4
It's just down to how Val() is implemented behind the scenes, it's more of a kludge than a function 
lxp
5
I didn't want to say it 
It even works without the quotes:
Output(Val(foobar));
Something that has confused me since the early days of Opus 13 
1 Like