Replies: 2 comments 3 replies
-
|
I think your best option is to create an |
Beta Was this translation helpful? Give feedback.
-
|
So I guess it's currently not possible then. I don't mind using a validated script, but I'm pretty sure the ability to evaluate individual statements and expressions would prove useful sometime, somewhere. If it's acceptable in theory, I can look into adding the feature. Also, why run it as a string? You already have a validated and parsed AST. Wouldn't it be better (performance-wise) to run the AST directly? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
The engine only accepts complete scripts. Also, the constructor for NodeList is internal, meaning you can't create new scripts in user code. Is there a way to evaluate expression nodes directly? This is useful for implementing e.g. simple one-line calculations in a system's configuration, while disallowing complex scripts, like so:
One would use
JSParser.ParseExpressionto parse that config entry as an expression, provide some value forx, and evaluate it.Beta Was this translation helpful? Give feedback.
All reactions