1.0.0 • Published 7 years ago
rbx-enum v1.0.0
rbx-enum
Raw Enum access support for roblox-ts. This gives you access to things like the Value property on EnumItems and the GetEnumItems function of Enums.
The module exports three functions:
getEnumItem
Accepts a roblox-ts enum value and results in the raw EnumItem object which is typed as:
interface RbxEnumItem {
Name: string
Value: number
EnumType: RbxEnum
}Note: This function accepts a number because TypeScript sees enums as numbers. Attempting to pass a member of a non-Roblox enum or a number will result in a runtime error.
Example
print(getEnumItem(Enum.RenderPriority.Camera).Value) // 200getEnumItems
Accepts a roblox-ts enum and results in an array of EnumItems (RbxEnumItem[] internally).
Example
getEnumItems(Enum.KeyCode).forEach(e => print(e.Name))getEnums
Returns an array of all Roblox Enums (RbxEnum[] internally). RbxEnum is typed as:
type RbxEnum = { [index: string]: RbxEnumItem }You can also call tostring on RbxEnum objects to get their human-readable name.