The engine implements enumerated types as the built-in Enum data type. Each enum has a predefined set of items (represented by the EnumItem data type), which are used by classes to allow changes to certain aspects of behavior or appearance. Enum items act as constants in place of using ambiguous numbers or strings to set a value. The Enums data type exposes all of the enums to the API with the
Enum global property.
For example, the Material enum is used by BasePart.Material which sets the texture of a part as well as physical properties depending on the item of the Material enum that is set.
local part = Instance.new("Part") part.Material = Enum.Material.Wood part.Parent = workspace
| Enum | Enums | EnumItem |
|---|---|---|
| Enum is a fixed storage of data types/values for use. | Enums are a Catergory of Enum items in Enum | A EnumItem is accessed with Enum.EnumsName.EnumItemName. These return a value. |
External links
- Enum, EnumItem, and Enums on the Roblox Creator Documentation
| Programming |
| ||||||
|---|---|---|---|---|---|---|---|
| Design | |||||||
| Assets | |||||||
| Tools | |||||||
| Monetization | |||||||
| Analytics | |||||||
| Advertising | |||||||
| Resources | |||||||
| Basic Lua types | |||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Roblox types |
| ||||||||||||||||||||||||||
| API reference only | |||||||||||||||||||||||||||