Skip to content

Struct Value

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

A value that crosses between the engine and scripts: no boxing for numbers, vectors, entities and enums. The To… methods check the kind and throw a whose message a script can show.

public readonly struct Value : IEquatable<Value>

Implements

IEquatable<Value>

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

EnumType

The enum a value is a member of.

public EnumInfo EnumType { get; }

Property Value

EnumInfo

IsNil

public bool IsNil { get; }

Property Value

bool

Kind

public ValueKind Kind { get; }

Property Value

ValueKind

Methods

Bool(bool)

public static Value Bool(bool value)

Parameters

value bool

Returns

Value

Entity(Entity)

public static Value Entity(Entity value)

Parameters

value Entity

Returns

Value

Enum(EnumInfo, long)

public static Value Enum(EnumInfo type, long value)

Parameters

type EnumInfo

value long

Returns

Value

Equals(Value)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(Value other)

Parameters

other Value

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object?

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

Float(double)

public static Value Float(double value)

Parameters

value double

Returns

Value

Function(ScriptFunction?)

public static Value Function(ScriptFunction? value)

Parameters

value ScriptFunction?

Returns

Value

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Int(long)

public static Value Int(long value)

Parameters

value long

Returns

Value

List(IReadOnlyList<Value>?)

public static Value List(IReadOnlyList<Value>? items)

Parameters

items IReadOnlyList<Value>?

Returns

Value

ListOf<T>(IEnumerable<T>?, Func<T, Value>)

public static Value ListOf<T>(IEnumerable<T>? items, Func<T, Value> convert)

Parameters

items IEnumerable<T>?

convert Func<T, Value>

Returns

Value

Type Parameters

T

Object(EngineObject?)

An object; null is nil.

public static Value Object(EngineObject? value)

Parameters

value EngineObject?

Returns

Value

Quat(Quaternion)

public static Value Quat(Quaternion value)

Parameters

value Quaternion

Returns

Value

String(string?)

A string; null is nil.

public static Value String(string? value)

Parameters

value string?

Returns

Value

Table(ScriptTable?)

A table kept by reference; null is nil.

public static Value Table(ScriptTable? value)

Parameters

value ScriptTable?

Returns

Value

ToAssetRef()

The text of a string value read as an asset reference (path, path|uid://… or uid://…); what the generated setters of properties call. A bad text is a , which a script can show, and not a .

public AssetRef ToAssetRef()

Returns

AssetRef

ToBool()

public bool ToBool()

Returns

bool

ToByte()

public byte ToByte()

Returns

byte

ToDouble()

public double ToDouble()

Returns

double

ToEntity()

public Entity ToEntity()

Returns

Entity

ToEnum()

The numeric value of an enum member.

public long ToEnum()

Returns

long

ToFunction()

public ScriptFunction ToFunction()

Returns

ScriptFunction

ToInt16()

public short ToInt16()

Returns

short

ToInt32()

public int ToInt32()

Returns

int

ToInt64()

An integer; a float with no fraction is accepted (scripts only have doubles).

public long ToInt64()

Returns

long

ToList()

public IReadOnlyList<Value> ToList()

Returns

IReadOnlyList<Value>

ToListOf<T>(Func<Value, T>)

public List<T> ToListOf<T>(Func<Value, T> convert)

Parameters

convert Func<Value, T>

Returns

List<T>

Type Parameters

T

ToObject<T>()

The object, which must be a T and alive.

public T ToObject<T>() where T : EngineObject

Returns

T

Type Parameters

T

ToQuaternion()

public Quaternion ToQuaternion()

Returns

Quaternion

ToSByte()

public sbyte ToSByte()

Returns

sbyte

ToSingle()

public float ToSingle()

Returns

float

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

ToStringValue()

public string ToStringValue()

Returns

string

ToTable()

public ScriptTable ToTable()

Returns

ScriptTable

ToUInt16()

public ushort ToUInt16()

Returns

ushort

ToUInt32()

public uint ToUInt32()

Returns

uint

ToUInt64()

public ulong ToUInt64()

Returns

ulong

ToVector3()

public Vector3 ToVector3()

Returns

Vector3

Vector(Vector3)

public static Value Vector(Vector3 value)

Parameters

value Vector3

Returns

Value

Operators

operator ==(Value, Value)

public static bool operator ==(Value left, Value right)

Parameters

left Value

right Value

Returns

bool

operator !=(Value, Value)

public static bool operator !=(Value left, Value right)

Parameters

left Value

right Value

Returns

bool