Interface IScriptHelper
Namespace: LemonEdge.API.Core.Scripting
Assembly: LemonEdge.API.dll
Syntax
public interface IScriptHelper
Methods
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
Task<object> EvaluateFormulaType(string formula, Type contextType, object context)
Parameters
Type | Name | Description |
---|---|---|
string | formula | The formula, or script, to be parsed and evaluated |
Type | contextType | The type of the context object that can be referenced by the formula or script |
object | context | The context object that can be referenced by the formula or script |
Returns
Type | Description |
---|---|
Task<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
Task<object> EvaluateFormulaType(Type resultType, string formula, Type contextType, object context)
Parameters
Type | Name | Description |
---|---|---|
Type | resultType | The type of the result returned from this formula or script |
string | formula | The formula, or script, to be parsed and evaluated |
Type | contextType | The type of the context object that can be referenced by the formula or script |
object | context | The context object that can be referenced by the formula or script |
Returns
Type | Description |
---|---|
Task<object> | The result of evaluating the specified |
EvaluateFormula<T>(string, Type, object, bool)
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
Task<T> EvaluateFormula<T>(string formula, Type contextType, object context, bool compileOnly = false)
Parameters
Type | Name | Description |
---|---|---|
string | formula | The formula, or script, to be parsed and evaluated |
Type | contextType | The type of the context object that can be referenced by the formula or script |
object | context | The context object that can be referenced by the formula or script |
bool | compileOnly | Whether to just compile the script for the purpose of initialisation, or also execute it. |
Returns
Type | Description |
---|---|
Task<T> | The result of evaluating the specified |
Type Parameters
Name | Description |
---|---|
T | The type of the result returned from this formula or script |
IsValid<T>(string, Type)
Throws an error with any compilation exceptions
Declaration
bool IsValid<T>(string formula, Type contextType)
Parameters
Type | Name | Description |
---|---|---|
string | formula | |
Type | contextType |
Returns
Type | Description |
---|---|
bool |
Type Parameters
Name | Description |
---|---|
T |