reckfellENGINE

Expression

Parsing and evaluation of expressions with named inputs.

On this page
class ExpressionReckfellSharpInherits RefCounted

Parses an expression with Parse and evaluates it with Execute using positional Variant inputs. This is an expression language rather than a C# interpreter. Check the Parse Error first, then HasExecuteFailed after Execute and the result type. Nil may be valid. GetErrorText can retain an earlier error after a successful Execute. constCallsOnly restricts object method calls rather than isolating arbitrary untrusted code.

Complete numeric example.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

ExpressionConstructor
# Expression
C#
public Expression();

Methods5

ExecuteVariant
# Execute
C#
public Variant Execute(Reckfell.Collections.Array inputs = null, ReckfellObject baseInstance = null, bool showError = true, bool constCallsOnly = false);

Evaluates a successfully parsed expression. Check HasExecuteFailed afterward; old error text does not identify a current failure. Supply new inputs to reevaluate without parsing again.

Parameters
NameTypeDefault
inputsReckfell.Collections.Arraynull
baseInstanceReckfellObjectnull
showErrorbooltrue
constCallsOnlyboolfalse
inputs

Values in the inputNames order from Parse. Accessing a missing input causes execution failure. null supplies an empty array.

baseInstance

Object for implicit method/property access. null supplies no such object; it does not restrict every built-in expression function.

showError

When true, ordinary evaluation failures are also printed by the engine. false allows handling through HasExecuteFailed/GetErrorText; it does not make evaluation succeed.

constCallsOnly

Restricts Variant object method calls to constant calls. It does not disable all built-ins or guarantee isolation, no side effects or resource limits.

Returns Variant

The Variant result. Nil is a valid value and does not alone indicate failure. Do not use the result as a successful calculation when HasExecuteFailed is true.

GetErrorTextstring
# GetErrorText
C#
public string GetErrorText();

Returns diagnostic text. Parse clears it, but a successful Execute need not clear an earlier failure message. Check the current operation status first.

Returns string

Parse or execution error text; it may be empty or stale after a successful Execute.

HasExecuteFailedbool
# HasExecuteFailed
C#
public bool HasExecuteFailed();

Check immediately after Execute. Detect Parse failure through its returned Error rather than this method.

Returns bool

true when the last Execute failed; false after successful execution, including a Nil result.

Parse2 overloads
# Parse · 1/2
C#
public Error Parse(string expression, ReadOnlySpan<string> inputNames);

Replaces the previous parsed expression and clears error text. Input names determine the order of values in a later Execute. Do not Execute after a parse failure.

Parameters
NameTypeDefault
expressionstring—
inputNamesReadOnlySpan<string>—
expression

Expression-language source text. Its literals, operators and supported calls are not arbitrary C# syntax.

inputNames

Names of input values in the order of the later Execute array. An empty span declares no named inputs.

Returns Error

Error.Ok on successful parsing; Error.InvalidParameter on a parse error. Read GetErrorText for details.

# Parse · 2/2
C#
public Error Parse(string expression, string[] inputNames = null);

Replaces the previous parsed expression and clears error text. Input names determine the order of values in a later Execute. Do not Execute after a parse failure.

Parameters
NameTypeDefault
expressionstring—
inputNamesstring[]null
expression

Expression-language source text. Its literals, operators and supported calls are not arbitrary C# syntax.

inputNames

Names of input values in the order of the later Execute array. null means an empty list.

Returns Error

Error.Ok on successful parsing; Error.InvalidParameter on a parse error. Read GetErrorText for details.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.