Enum

Constructors

NameDescription
Enum.<EnumName> (e.g. Enum.KeyCode, Enum.Material)Enum has no direct new() constructor. Every Enum is a built-in global accessed by name off the Enums singleton (the global Enum table), for example Enum.KeyCode or Enum.Material.

Code Snippet

local Material = Enum.Material

for _, item in Material:GetEnumItems() do
    print(item.Name, item.Value)
end

local wood = Material:FromName("Wood")
print(wood == Enum.Material.Wood) --> true

Methods

NameParametersReturnsDescription
GetEnumItems()Void{EnumItem}Returns an array of all EnumItem options available for this Enum.
FromName(name: string)name: stringEnumItem?Returns the EnumItem in this Enum whose Name matches the given string, or nil if no match exists.
FromValue(value: number)value: numberEnumItem?Returns the EnumItem in this Enum whose integer Value matches the given number, or nil if no match exists.