Skip to content

Class ScriptRecord

Namespace: Apogee.Reflection
Assembly: Apogee.Reflection.dll

A table the engine makes for scripts: named fields holding values (numbers, strings, booleans, lists). A method that returns one gives the script a new table with those fields; nil fields are left out. It is read-only and lives in C#, so it is not a table a script gave the engine (that is any other ).

public sealed class ScriptRecord : ScriptTable, IDisposable

Inheritance

object ← ScriptTable ← ScriptRecord

Implements

IDisposable

Inherited Members

ScriptTable.KindAt(ReadOnlySpan<DataPathSegment>), ScriptTable.GetAt(ReadOnlySpan<DataPathSegment>), ScriptTable.SetAt(ReadOnlySpan<DataPathSegment>, Value), ScriptTable.LengthAt(ReadOnlySpan<DataPathSegment>), ScriptTable.KeysAt(ReadOnlySpan<DataPathSegment>), ScriptTable.FunctionAt(ReadOnlySpan<DataPathSegment>), ScriptTable.Dispose(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Fields

The fields in name order.

public IEnumerable<KeyValuePair<string, Value>> Fields { get; }

Property Value

IEnumerable<KeyValuePair<string, Value>>

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public override void Dispose()

FunctionAt(ReadOnlySpan<DataPathSegment>)

The function at the path, or null.

public override ScriptFunction? FunctionAt(ReadOnlySpan<DataPathSegment> path)

Parameters

path ReadOnlySpan<DataPathSegment>

Returns

ScriptFunction?

GetAt(ReadOnlySpan<DataPathSegment>)

The boolean, number or string at the path, or nil.

public override Value GetAt(ReadOnlySpan<DataPathSegment> path)

Parameters

path ReadOnlySpan<DataPathSegment>

Returns

Value

KeysAt(ReadOnlySpan<DataPathSegment>)

The names of the fields of the table at the path, sorted.

public override IReadOnlyList<string> KeysAt(ReadOnlySpan<DataPathSegment> path)

Parameters

path ReadOnlySpan<DataPathSegment>

Returns

IReadOnlyList<string>

KindAt(ReadOnlySpan<DataPathSegment>)

public override ScriptDataKind KindAt(ReadOnlySpan<DataPathSegment> path)

Parameters

path ReadOnlySpan<DataPathSegment>

Returns

ScriptDataKind

LengthAt(ReadOnlySpan<DataPathSegment>)

The number of elements of the list at the path.

public override int LengthAt(ReadOnlySpan<DataPathSegment> path)

Parameters

path ReadOnlySpan<DataPathSegment>

Returns

int

SetAt(ReadOnlySpan<DataPathSegment>, Value)

Writes a scalar at the path (the field must exist). False when it cannot be.

public override bool SetAt(ReadOnlySpan<DataPathSegment> path, Value value)

Parameters

path ReadOnlySpan<DataPathSegment>

value Value

Returns

bool

With(string, Value)

Sets a field; a nil value removes it. Returns the record, so that fields chain.

public ScriptRecord With(string name, Value value)

Parameters

name string

value Value

Returns

ScriptRecord