UserEnums - A user-created, autocomplete recreation of Roblox's Enum

UserEnums

A user-created, autocomplete recreation of Roblox’s Enum.

Model link
Github

Features

  1. Auto-complete Enums.
  2. You can create Enums that can be used in multiple scripts.
  3. Almost identical to Enums created by Roblox.

How to use

  • First, write EnumList in the EnumList module script under Enums.
  • Second, require Enums in the script you want to use.

Example

When you want to create Enums called Enum.TestEnum.TestEnumItem1 and Enum.TestEnum.TestEnumItem2

Enums.EnumList:

local EnumList = {
    TestEnum = {
        TestEnumItem1 = {},
        TestEnumItem2 = {},
    }
}

Script:

local Enums = require(Location of Enums)
2 Likes

Hey! Your asset is currently private.

2 Likes

I can download it perfectly fine.

It was* actually, thanks away.

I would appreciate it if you could let me know about any inconveniences, areas that need improvement, bugs, etc. while using this library.

1 Like

Why would I choice this if it is almost identical to Roblox’s one?

It’s supposed to be customizable, and roblox does not provide a built-in way to create your own enums. For example, say you want to define access permission levels:

local CustomEnums = {
    USER = 1;
    MOD = 2;
    ADMINISTRATIVE = 3;
}

local PermissionLevel == CustomEnums.ADMINISTRATIVE

if PermissionLevel == CustomEnums.MOD then
    print('Its a moderator!')
elseif PermissionLevel == CustomEnums.ADMINISTRATIVE then
    print('Its an admin!')
elseif PermissionLevel == CustomEnums.USER then
    print('Its a user!')
end

v0.2.0 Update

  • Changed to auto-complete without having to write Types.
  • Changed to use custom types.

v0.3.0 Update

  • Fixed Type Error
  • Changed method.