PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Jun 27 2019, 3:38 PM PST 2 min

An enumeration — sometimes shortened to “enum” — is a special data type that can take one of a set of values. For example, the enum/Material enum represents the material type for a part.

In a script, enums are accessed through a global object called datatype/Enum. To get all of the datatype/EnumItem|EnumItem options available for an enum, call the GetEnumItems() method on an enum type:

Once you know the datatype/EnumItem|EnumItem options, you can set an enumerated property on an object in three different ways:

workspace.Part.Material = Enum.Material.Concrete  -- By full enum (preferred method)
workspace.Part.Material = 816  -- By enum value
workspace.Part.Material = "Concrete"  -- By enum name
Tags:
  • lua
  • enumeration
  • enum