Murl Engine Lua Addon API  Version 1.0 beta
Murl.Enum

Enumeration string mapping template class.


Table members

Functions


Murl.Enum.new(other)

Copy constructor.

Murl.Enum new(Murl.Enum other)

Parameters
otherThe enumeration to copy.
Returns
Murl.Enum


Methods


GetName()

Get the name of the enumerator.

String GetName()

Returns
String The name of the enumerator.

GetDefaultValue()

Get the default enumeration value.

Integer GetDefaultValue()

Returns
Integer The default value.

GetCount()

Get the total number of enumeration entries.

Integer GetCount()

Returns
Integer The number of entries.

IsEnumValueAvailable(value)

Check if an enumeration value is available.

Boolean IsEnumValueAvailable(Integer value)

Parameters
valueThe enumeration value to check.
Returns
Boolean true if the enumeration value is available.

IsEnumNameAvailable(name)

Check if an enumeration name is available.

Boolean IsEnumNameAvailable(String name)

Parameters
nameThe enumeration name to check.
Returns
Boolean true if the enumeration name is available.

GetEnumIndexByValue(value)

Get the zero-based index of an enumeration value.

Integer GetEnumIndexByValue(Integer value)

Parameters
valueThe enumeration value to check.
Returns
Integer The index in the range from 0 to GetCount()-1, or -1 if not found.

GetEnumIndexByValue(value, hash)

Get the zero-based index of an enumeration value.

Integer GetEnumIndexByValue(Integer value, Integer hash)

Parameters
valueThe enumeration value to check.
hashThe precomputed hash value.
Returns
Integer The index in the range from 0 to GetCount()-1, or -1 if not found.

GetEnumIndexByName(name)

Get the zero-based index of an enumeration name.

Integer GetEnumIndexByName(String name)

Parameters
nameThe enumeration name to check.
Returns
Integer The index in the range from 0 to GetCount()-1, or -1 if not found.

GetEnumIndexByName(name, hash)

Get the zero-based index of an enumeration name.

Integer GetEnumIndexByName(String name, Integer hash)

Parameters
nameThe enumeration name to check.
hashThe precomputed hash value.
Returns
Integer The index in the range from 0 to GetCount()-1, or -1 if not found.

GetEnumNameByIndex(index)

Get the enumeration name at a given index.

String GetEnumNameByIndex(Integer index)

Parameters
indexThe index to query, in the range from 0 to GetCount()-1.
Returns
String The enumeration name, or an empty string if index is out of range.

GetEnumValueByIndex(index)

Get the enumeration value at a given index.

Integer GetEnumValueByIndex(Integer index)

Parameters
indexThe index to query, in the range from 0 to GetCount()-1.
Returns
Integer The enumeration value, or the default value if index is out of range.

GetEnumNameByValue(value)

Get the enumeration name for a given enumeration value.

String GetEnumNameByValue(Integer value)

Parameters
valueThe enumeration value to look up.
Returns
String The string of the enumeration value or an empty string if the value is not found.

GetEnumNameByValue(value, hash)

Get the enumeration name for a given enumeration value, using a precomputed hash value.

String GetEnumNameByValue(Integer value, Integer hash)

Parameters
valueThe enumeration value to look up.
hashThe precomputed hash value.
Returns
String The string of the enumeration value or an empty string if the value is not found.

GetEnumNameByValue(value, hash, error)

Get the enumeration name for a given enumeration value, using a precomputed hash value.

String, Boolean GetEnumNameByValue(Integer value, Integer hash, Boolean error)

Parameters
valueThe enumeration value to look up.
hashThe precomputed hash value.
errorThe error return value is set to true if the value is not found, or false if OK.
Returns
String The string of the enumeration value or an empty string if the value is not found.
Boolean error The error return value is set to true if the value is not found, or false if OK.

GetEnumNameByValue(value, hash, error, clearError)

Get the enumeration name for a given enumeration value, using a precomputed hash value.

String, Boolean GetEnumNameByValue(Integer value, Integer hash, Boolean error, Boolean clearError)

Parameters
valueThe enumeration value to look up.
hashThe precomputed hash value.
errorThe error return value is set to true if the value is not found.
clearErrorIf false, the error parameter is left in its given state if no error occurred.
Returns
String The string of the enumeration value or an empty string if the value is not found.
Boolean error The error return value is set to true if the value is not found.

GetEnumNameByValue(value, error)

Get the enumeration name for a given enumeration value.

String, Boolean GetEnumNameByValue(Integer value, Boolean error)

Parameters
valueThe enumeration value to look up.
errorThe error return value is set to true if the value is not found, or false if OK.
Returns
String The string of the enumeration value or an empty string if the value is not found.
Boolean error The error return value is set to true if the value is not found, or false if OK.

GetEnumNameByValue(value, error, clearError)

Get the enumeration name for a given enumeration value.

String, Boolean GetEnumNameByValue(Integer value, Boolean error, Boolean clearError)

Parameters
valueThe enumeration value to look up.
errorThe error return value is set to true if the value is not found.
clearErrorIf false, the error parameter is left in its given state if no error occurred.
Returns
String The string of the enumeration value or an empty string if the value is not found.
Boolean error The error return value is set to true if the value is not found.

GetEnumValueByName(name)

Get the enumeration value for a given enumeration name.

Integer GetEnumValueByName(String name)

Parameters
nameThe name string to look up.
Returns
Integer The enumeration value of the string or the default value if the string is not found.

GetEnumValueByName(name, hash)

Get the enumeration value for a given enumeration name, using a precomputed hash value.

Integer GetEnumValueByName(String name, Integer hash)

Parameters
nameThe name string to look up.
hashThe precomputed hash value.
Returns
Integer The enumeration value of the string or the default value if the string is not found.

GetEnumValueByName(name, hash, error)

Get the enumeration value for a given enumeration name, using a precomputed hash value.

Integer, Boolean GetEnumValueByName(String name, Integer hash, Boolean error)

Parameters
nameThe name string to look up.
hashThe precomputed hash value.
errorThe error return value is set to true if the value is not found, or false if OK.
Returns
Integer The enumeration value of the string or the default value if the string is not found.
Boolean error The error return value is set to true if the value is not found, or false if OK.

GetEnumValueByName(name, hash, error, clearError)

Get the enumeration value for a given enumeration name, using a precomputed hash value.

Integer, Boolean GetEnumValueByName(String name, Integer hash, Boolean error, Boolean clearError)

Parameters
nameThe name string to look up.
hashThe precomputed hash value.
errorThe error return value is set to true if the name is not found.
clearErrorIf false, the error parameter is left in its given state if no error occurred.
Returns
Integer The enumeration value of the string or the default value if the string is not found.
Boolean error The error return value is set to true if the name is not found.

GetEnumValueByName(name, error)

Get the enumeration value for a given enumeration name.

Integer, Boolean GetEnumValueByName(String name, Boolean error)

Parameters
nameThe name string to look up.
errorThe error return value is set to true if the value is not found, or false if OK.
Returns
Integer The enumeration value of the string or the default value if the string is not found.
Boolean error The error return value is set to true if the value is not found, or false if OK.

GetEnumValueByName(name, error, clearError)

Get the enumeration value for a given enumeration name.

Integer, Boolean GetEnumValueByName(String name, Boolean error, Boolean clearError)

Parameters
nameThe name string to look up.
errorThe error return value is set to true if the name is not found.
clearErrorIf false, the error parameter is left in its given state if no error occurred.
Returns
Integer The enumeration value of the string or the default value if the string is not found.
Boolean error The error return value is set to true if the name is not found.

GetItemsByName()

Get the enumeration values by name map.

Murl.Map.StringUInt32 GetItemsByName()

Returns
Murl.Map.StringUInt32 The enumeration values by name map.

GetItemsByValue()

Get the names by enumeration value map.

Murl.Map.UInt32String GetItemsByValue()

Returns
Murl.Map.UInt32String The names by enumeration value map.


Metamethods


The length operator

The length operator is denoted by the unary prefix operator #.

Returns
GetCount()

The tostring operator

Converts the object content to a string in a reasonable format.

Returns
GetName()