Class Table
- Namespace
- Luny
- Assembly
- Luny.dll
Dictionary-based variable storage.
public sealed class Table : ITable
- Inheritance
-
objectTable
- Implements
Constructors
Table()
public Table()
Properties
Count
Gets the number of variables.
public int Count { get; }
Property Value
- int
this[string]
Gets or sets a variable by name.
public Variable this[string key] { get; set; }
Parameters
keystring
Property Value
Methods
DefineConstant(string, Variable)
Defines a constant variable that cannot be modified after creation.
public Table.ScalarVarHandle DefineConstant(string key, Variable value)
Parameters
keystringThe constant name.
valueVariableThe constant value.
Returns
- Table.ScalarVarHandle
The handle to the constant.
DefineVariable(string, Variable)
Defines a variable with initial value.
public Table.ScalarVarHandle DefineVariable(string key, Variable value)
Parameters
keystringvalueVariable
Returns
Exceptions
- InvalidOperationException
GetEnumerator()
public IEnumerator<KeyValuePair<string, Variable>> GetEnumerator()
Returns
- IEnumerator<KeyValuePair<string, Variable>>
GetHandle(string)
Gets a handle to a variable.
public Table.ScalarVarHandle GetHandle(string key)
Parameters
keystring
Returns
GetHandle<T>(string)
Gets or creates a typed handle to a variable.
public Table.VarHandle<T> GetHandle<T>(string key)
Parameters
keystring
Returns
Type Parameters
T
Get<T>(string)
Gets a variable with type casting.
public T Get<T>(string key)
Parameters
keystring
Returns
- T
Type Parameters
T
Has(string)
Checks if a variable exists.
public bool Has(string key)
Parameters
keystring
Returns
- bool
Remove(string)
Removes a variable.
public bool Remove(string key)
Parameters
keystring
Returns
- bool
RemoveAll()
Removes all variables.
public void RemoveAll()
ResetValue(string)
Resets a variable's value to default.
public void ResetValue(string key)
Parameters
keystring
ResetValues()
Resets values of all variables to their default value.
public void ResetValues()
ToString()
[ExcludeFromCodeCoverage]
public override string ToString()
Returns
- string
Events
OnVariableChanged
Fired when a variable is changed. Only invoked in debug builds.
public event EventHandler<VariableChangedArgs> OnVariableChanged
Event Type
- EventHandler<VariableChangedArgs>