Class ScriptHelper
A helper class for evaluating scripts and formulas in LemonEdge
Inheritance
Inherited Members
Namespace: LemonEdge.Utils
Assembly: Utils.dll
Syntax
public static class ScriptHelper
Properties
RequiresDLLScripting
Indicates if the script can be evaluated in memory using ScriptRunner, or if it needs to be compiled down to a dynamic dll and executed.
WASM requires dynamic dlls instead of ScriptRunner
Declaration
public static bool RequiresDLLScripting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
SupportsScripting
Indicates if the eviroment supports scripting. UWP does not.
Declaration
public static bool SupportsScripting { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
EvaluateFormula<T>(String, Type, Object)
Evaluates the specified formula
and returns the result as the specified T
The script can take a context
that can be referenced in the formula, and must be of type contextType
Declaration
public static Task<T> EvaluateFormula<T>(string formula, Type contextType, object context)
Parameters
Type | Name | Description |
---|---|---|
System.String | formula | The formula, or script, to be parsed and evaluated |
System.Type | contextType | The type of the context object that can be referenced by the formula or script |
System.Object | context | The context object that can be referenced by the formula or script |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | The result of evaluating the specified |
Type Parameters
Name | Description |
---|---|
T | The type of the result returned from this formula or script |
EvaluateFormulaType(String, Type, Object)
Evaluates the specified formula
and returns the result as the specified resultType
The script can take a context
that can be referenced in the formula, and must be of type contextType
Declaration
public static Task<object> EvaluateFormulaType(string formula, Type contextType, object context)
Parameters
Type | Name | Description |
---|---|---|
System.String | formula | The formula, or script, to be parsed and evaluated |
System.Type | contextType | The type of the context object that can be referenced by the formula or script |
System.Object | context | The context object that can be referenced by the formula or script |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | The result of evaluating the specified |
EvaluateFormulaType(Type, String, Type, Object)
Evaluates the specified formula
and returns the result as the specified resultType
The script can take a context
that can be referenced in the formula, and must be of type contextType
Declaration
public static Task<object> EvaluateFormulaType(Type resultType, string formula, Type contextType, object context)
Parameters
Type | Name | Description |
---|---|---|
System.Type | resultType | The type of the result returned from this formula or script |
System.String | formula | The formula, or script, to be parsed and evaluated |
System.Type | contextType | The type of the context object that can be referenced by the formula or script |
System.Object | context | The context object that can be referenced by the formula or script |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | The result of evaluating the specified |