- expression is a mathematical expression to be solved.
Evaluates an expression using only the base components of the evaluator:
- No spaces are allowed within the expression, except as part of a zone/location name.
- + - * / ( ) have their usual mathematical meaning and precedence.
- ^ is exponentiation, with the highest precedence.
- Functions available: ceil(x) floor(x) sqrt(x) min(x,y) max(x,y)
- Preferences function: pref(text)
- This must be used on preferences with a float value ONLY - merely retrieving an integer pref will corrupt it!
- There could be at most one of each text function in an expression.
- This is no longer the case however and multiple of the same text functions should now work properly.
- This wrapper allows user-defined variables to be used as well, which must have names starting with a lower-case letter (or underscore) to distinguish them from built-in variables. Variables are supplied as a float[string] map.
This script expands expression_eval() to include support for user-defined variables. It is extremely complex, but it is extremely useful to anyone who wants to use expression_eval().