Difference between revisions of "ObjectType:enumtype"
Jump to navigation
Jump to search
(3 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
{{ObjectType-Vitals|enum|[[LavishScript]]none|same as Name|enum|no|void *}} | {{ObjectType-Vitals|enum|[[LavishScript]]none|same as Name|enum|no|void *}} | ||
− | The enum type provides access to get and set available values for the type. The enum type can then be used directly as a LavishScript Object Type. | + | The enum type provides access to get and set available values for the type of enum. The enum type can then be used directly as a LavishScript Object Type. |
== Members == | == Members == | ||
* [[ObjectType:string|string]] '''Name''': Name of the enum type | * [[ObjectType:string|string]] '''Name''': Name of the enum type | ||
− | * [[ | + | * [[ObjectType:int64|int64]] '''ValueByName['''name''']''': Retrieves a value by its name |
* [[ObjectType:string|string]] '''NameByValue['''#''']''': Retrieves a name by a given value (or for flags, a set of names from the combined value) | * [[ObjectType:string|string]] '''NameByValue['''#''']''': Retrieves a name by a given value (or for flags, a set of names from the combined value) | ||
Line 12: | Line 12: | ||
*'''SetValue['''name''','''#''']''': Assigns a value to a given name | *'''SetValue['''name''','''#''']''': Assigns a value to a given name | ||
*'''GetIterator['''iterator''']''': Sets an iterator for iterating the available values | *'''GetIterator['''iterator''']''': Sets an iterator for iterating the available values | ||
+ | |||
+ | == Examples == | ||
+ | ; register an "enumbers" enum and object type | ||
+ | LavishScript:RegisterEnum[enumbers] | ||
+ | ; set values in the enum | ||
+ | Enum[enumbers]:SetValue[zero,0] | ||
+ | Enum[enumbers]:SetValue[one,1] | ||
+ | Enum[enumbers]:SetValue[two,2] | ||
+ | Enum[enumbers]:SetValue[three,3] | ||
+ | Enum[enumbers]:SetValue[four,4] | ||
+ | Enum[enumbers]:SetValue[five,5] | ||
+ | Enum[enumbers]:SetValue[six,6] | ||
+ | Enum[enumbers]:SetValue[seven,7] | ||
+ | Enum[enumbers]:SetValue[eight,8] | ||
+ | Enum[enumbers]:SetValue[nine,9] | ||
+ | ; convert integers to enumbers | ||
+ | echo ${Int[0](enumbers)} | ||
+ | echo ${Int[1](enumbers)} | ||
+ | echo ${Int[2](enumbers)} | ||
+ | echo ${Int[3](enumbers)} | ||
+ | echo ${Int[4](enumbers)} | ||
+ | echo ${Int[5](enumbers)} | ||
+ | echo ${Int[6](enumbers)} | ||
+ | echo ${Int[7](enumbers)} | ||
+ | echo ${Int[8](enumbers)} | ||
+ | echo ${Int[9](enumbers)} | ||
== See Also == | == See Also == | ||
− | + | {{LavishScript:ObjectType}} | |
− | |||
[[Category:LavishScript Enums]] | [[Category:LavishScript Enums]] |
Latest revision as of 16:31, 8 July 2018
Contents
Overview
enum | |
Defined By | LavishScriptnone |
Inherits | same as Name |
Reduces To | enum |
Variable Object Type | no |
Uses Sub-Types | void * |
C/C++ Type | {{{7}}} |
The enum type provides access to get and set available values for the type of enum. The enum type can then be used directly as a LavishScript Object Type.
Members
- string Name: Name of the enum type
- int64 ValueByName[name]: Retrieves a value by its name
- string NameByValue[#]: Retrieves a name by a given value (or for flags, a set of names from the combined value)
Methods
- SetValue[name,#]: Assigns a value to a given name
- GetIterator[iterator]: Sets an iterator for iterating the available values
Examples
; register an "enumbers" enum and object type LavishScript:RegisterEnum[enumbers] ; set values in the enum Enum[enumbers]:SetValue[zero,0] Enum[enumbers]:SetValue[one,1] Enum[enumbers]:SetValue[two,2] Enum[enumbers]:SetValue[three,3] Enum[enumbers]:SetValue[four,4] Enum[enumbers]:SetValue[five,5] Enum[enumbers]:SetValue[six,6] Enum[enumbers]:SetValue[seven,7] Enum[enumbers]:SetValue[eight,8] Enum[enumbers]:SetValue[nine,9] ; convert integers to enumbers echo ${Int[0](enumbers)} echo ${Int[1](enumbers)} echo ${Int[2](enumbers)} echo ${Int[3](enumbers)} echo ${Int[4](enumbers)} echo ${Int[5](enumbers)} echo ${Int[6](enumbers)} echo ${Int[7](enumbers)} echo ${Int[8](enumbers)} echo ${Int[9](enumbers)}
See Also
LavishScript Object Types
- Text
- string - mutablestring - unistring
- Numbers
- byte - float - float64 - int - uint - int64
- Boolean (TRUE/FALSE)
- bool
- Pointers
- boolptr - byteptr - floatptr - float64ptr - intptr - uintptr - int64ptr - rgbptr - stringptr
- Containers
- objectcontainer - array - index - collection - queue - stack - set - variablescope
- JSON
- jsonobject - jsonarray - jsonvaluecontainer - jsonvalue
- Iteration
- iterator - jsoniterator
- Date/Time
- time
- File Handling
- filepath - file - filelist - filelistentry
- Tasks
- lavishmachine - Accessed via the Top-Level Object LMAC
- task - tasklibrary - taskmanager - tasktype - taskpulseargs - elmactaskstate