Skip to main content

EnumList

Defines a new Enum.

Functions

new

EnumList.new(
namestring,
enums{string}
) → EnumList

Constructs a new EnumList.

local directions = EnumList.new("Directions", {
	"Up",
	"Down",
	"Left",
	"Right",
})

local direction = directions.Up

BelongsTo

EnumList:BelongsTo(objany) → boolean

Returns true if obj belongs to the EnumList.

GetEnumItems

since v2.0.0
</>
EnumList:GetEnumItems() → {EnumItem}

Types

interface EnumItem {
Namestring
Valuenumber
EnumTypeEnumList
}

Returns an array of all enum items.

GetName

since v2.0.0
</>
EnumList:GetName() → string

Get the name of the enum.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "Constructs a new EnumList.\n\n```lua\nlocal directions = EnumList.new(\"Directions\", {\n\t\"Up\",\n\t\"Down\",\n\t\"Left\",\n\t\"Right\",\n})\n\nlocal direction = directions.Up\n```",
            "params": [
                {
                    "name": "name",
                    "desc": "",
                    "lua_type": "string"
                },
                {
                    "name": "enums",
                    "desc": "",
                    "lua_type": "{string}"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "EnumList"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 57,
                "path": "modules/enum-list/init.luau"
            }
        },
        {
            "name": "BelongsTo",
            "desc": "Returns `true` if `obj` belongs to the EnumList.",
            "params": [
                {
                    "name": "obj",
                    "desc": "",
                    "lua_type": "any"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 77,
                "path": "modules/enum-list/init.luau"
            }
        },
        {
            "name": "GetEnumItems",
            "desc": "Returns an array of all enum items.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{EnumItem}"
                }
            ],
            "function_type": "method",
            "since": "v2.0.0",
            "source": {
                "line": 86,
                "path": "modules/enum-list/init.luau"
            }
        },
        {
            "name": "GetName",
            "desc": "Get the name of the enum.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "string"
                }
            ],
            "function_type": "method",
            "since": "v2.0.0",
            "source": {
                "line": 95,
                "path": "modules/enum-list/init.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "EnumItem",
            "desc": "",
            "fields": [
                {
                    "name": "Name",
                    "lua_type": "string",
                    "desc": ""
                },
                {
                    "name": "Value",
                    "lua_type": "number",
                    "desc": ""
                },
                {
                    "name": "EnumType",
                    "lua_type": "EnumList",
                    "desc": ""
                }
            ],
            "source": {
                "line": 14,
                "path": "modules/enum-list/init.luau"
            }
        }
    ],
    "name": "EnumList",
    "desc": "Defines a new Enum.",
    "source": {
        "line": 37,
        "path": "modules/enum-list/init.luau"
    }
}