Enumerator
#
TypesEnumeratorObject
#
Enuminterface
EnumeratorObject {
cast:Â
(
value:Â
any
)
 →Â
(
EnumeratorItem
<
Value
>
 |Â
boolean
,
string?
)
--
Attempts to cast a value to an EnumeratorItem.
fromRawValue:Â
(
rawValue:Â
Value
)
 →Â
EnumeratorItem
<
Value
>
?
--
Attempts to create an EnumeratorItem from a raw value.
getEnumeratorItems:Â
(
)
 →Â
{
EnumeratorItem
<
Value
>
}
--
Returns a table of all EnumeratorItems in the EnumeratorObject.
getSortedEnumeratorItems:Â
(
)
 →Â
{
EnumeratorItem
<
Value
>
}
--
Returns a table of all EnumeratorItems in the EnumeratorObject, sorted by value.
isEnumValue:Â
(
value:Â
any
)
 →Â
boolean
--
Returns whether or not a value is an EnumeratorItem.
}
An EnumeratorObject is meant to represent a collection of unique values.
#
FunctionsEnumerator
#
Enumerator.
Enumerator
(
enumName:Â
string
,
--
The name of the enumeration.
enumValues:Â
{
string
}
 |Â
{
[string]:Â
any
}
--
The values of the enumeration.
) →Â
EnumeratorObject
--
The new EnumeratorObject.
Creates a new EnumeratorObject
.
local Fruit = enumerator("Fruit", {"Apple", "Banana", "Orange", "Grape"})
local Numbers = enumerator("Numbers", {
One = 1;
Two = 2;
Three = 3;
})