Struct LuaField
- Namespace
- Cobilas.GodotEngine.GDLua
- Assembly
- com.cobilas.godot.lua.dll
Represents a Lua field with a name and value, providing type conversion capabilities and disposable pattern for resource management.
public struct LuaField : IConvertible, IDisposable
- Implements
- Inherited Members
Remarks
This struct implements IConvertible for seamless type conversions and IDisposable for proper resource cleanup when working with Lua interop.
Constructors
LuaField(string, object?)
Represents a Lua field with a name and value, providing type conversion capabilities and disposable pattern for resource management.
public LuaField(string fieldName, object? value)
Parameters
Remarks
This struct implements IConvertible for seamless type conversions and IDisposable for proper resource cleanup when working with Lua interop.
Properties
FieldName
Gets the name of the Lua field
public readonly string? FieldName { get; }
Property Value
- string
The name of the field.
Exceptions
- ObjectDisposedException
Thrown when the LuaField has been disposed.
Value
Gets the value of the Lua field
public readonly object? Value { get; }
Property Value
- object
The field value as an object.
Exceptions
- ObjectDisposedException
Thrown when the LuaField has been disposed.
ValueType
Gets the data type of the Lua field value.
public readonly LuaField.LuaFieldType ValueType { get; }
Property Value
- LuaField.LuaFieldType
The LuaField.LuaFieldType representing the value's data type.
Methods
Dispose()
Releases all resources used by the LuaField
public void Dispose()
Exceptions
- ObjectDisposedException
Thrown when the LuaField has already been disposed.
Operators
explicit operator LuaFieldType(LuaField)
Converts a LuaField to a LuaFieldType
public static explicit operator LuaField.LuaFieldType(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- LuaField.LuaFieldType
The LuaFieldType representing the field value's data type.
explicit operator LuaTable(LuaField)
Converts a LuaField to a LuaTable
public static explicit operator LuaTable(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- LuaTable
A LuaTable representation of the field value.
Exceptions
- InvalidCastException
Thrown when the field value is not a LuaTable.
explicit operator bool(LuaField)
Converts a LuaField to a boolean value
public static explicit operator bool(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- bool
A boolean representation of the field value.
explicit operator byte(LuaField)
Converts a LuaField to a byte
public static explicit operator byte(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- byte
A byte representation of the field value.
explicit operator char(LuaField)
Converts a LuaField to a character
public static explicit operator char(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- char
A character representation of the field value.
explicit operator DateTime(LuaField)
Converts a LuaField to a DateTime value
public static explicit operator DateTime(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- DateTime
A DateTime representation of the field value.
explicit operator decimal(LuaField)
Converts a LuaField to a decimal number
public static explicit operator decimal(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- decimal
A decimal representation of the field value.
explicit operator double(LuaField)
Converts a LuaField to a double-precision floating-point number
public static explicit operator double(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- double
A double representation of the field value.
explicit operator short(LuaField)
Converts a LuaField to a signed 16-bit integer
public static explicit operator short(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- short
A signed 16-bit integer representation of the field value.
explicit operator int(LuaField)
Converts a LuaField to a signed 32-bit integer
public static explicit operator int(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- int
A signed 32-bit integer representation of the field value.
explicit operator long(LuaField)
Converts a LuaField to a signed 64-bit integer
public static explicit operator long(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- long
A signed 64-bit integer representation of the field value.
explicit operator sbyte(LuaField)
Converts a LuaField to a signed byte
public static explicit operator sbyte(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- sbyte
A signed byte representation of the field value.
explicit operator float(LuaField)
Converts a LuaField to a single-precision floating-point number
public static explicit operator float(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- float
A float representation of the field value.
explicit operator string(LuaField)
Converts a LuaField to a string
public static explicit operator string(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- string
A string representation of the field value.
explicit operator TypeCode(LuaField)
Converts a LuaField to its TypeCode
public static explicit operator TypeCode(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- TypeCode
The TypeCode of the field value.
explicit operator ushort(LuaField)
Converts a LuaField to an unsigned 16-bit integer
public static explicit operator ushort(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- ushort
An unsigned 16-bit integer representation of the field value.
explicit operator uint(LuaField)
Converts a LuaField to an unsigned 32-bit integer
public static explicit operator uint(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- uint
An unsigned 32-bit integer representation of the field value.
explicit operator ulong(LuaField)
Converts a LuaField to an unsigned 64-bit integer
public static explicit operator ulong(LuaField f)
Parameters
fLuaFieldThe LuaField to convert.
Returns
- ulong
An unsigned 64-bit integer representation of the field value.