Table of Contents

Struct LuauValue

Namespace
LuauInterop
Assembly
LuauInterop.dll

Represents a raw Luau value.

public readonly struct LuauValue
Inherited Members

Constructors

LuauValue(LuauType, double, long, object?, LuaState?)

Represents a raw Luau value.

public LuauValue(LuauType type, double number, long integer, object? reference, LuaState? state = null)

Parameters

type LuauType
number double
integer long
reference object
state LuaState?

Properties

Integer

Gets the integer value.

public long Integer { get; }

Property Value

long

Remarks

Valid only when Type is Integer.

Nil

Gets a Luau nil value.

public static LuauValue Nil { get; }

Property Value

LuauValue

Number

Gets the numeric value.

public double Number { get; }

Property Value

double

Remarks

Valid only when Type is Number or Boolean.

Reference

Gets the reference-backed value.

public object? Reference { get; }

Property Value

object

Remarks

Used for strings and other managed reference-backed Luau values.

State

Gets the Lua state associated with this value, if applicable.

public LuaState? State { get; }

Property Value

LuaState?

Remarks

Valid only when Type is Function.

Type

Gets the Luau type of this value.

public LuauType Type { get; }

Property Value

LuauType

Methods

ToClr()

Converts this value into its managed CLR representation.

public object? ToClr()

Returns

object

The managed representation of the value, or null if the value is nil.

Exceptions

InvalidOperationException

The value does not contain the expected backing reference.

NotSupportedException

The value type is not supported for CLR conversion.

ToString()

Returns the string representation of this value.

public override string ToString()

Returns

string

The CLR string representation of the value, or "nil" if the value is nil.

Operators

implicit operator LuauValue(bool)

Converts a boolean into a Luau boolean value.

public static implicit operator LuauValue(bool value)

Parameters

value bool

Returns

LuauValue

implicit operator LuauValue(double)

Converts a double into a Luau number value.

public static implicit operator LuauValue(double value)

Parameters

value double

Returns

LuauValue

implicit operator LuauValue(int)

Converts a 32-bit integer into a Luau number value.

public static implicit operator LuauValue(int value)

Parameters

value int

Returns

LuauValue

implicit operator LuauValue(long)

Converts a 64-bit integer into a Luau integer value.

public static implicit operator LuauValue(long value)

Parameters

value long

Returns

LuauValue

implicit operator LuauValue(string)

Converts a string into a Luau string value.

public static implicit operator LuauValue(string value)

Parameters

value string

Returns

LuauValue