Enum module and types

This commit is contained in:
2024-03-14 22:54:04 -04:00
parent 1104964fd4
commit 22cce63ef4
3 changed files with 10 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,7 @@
--!optimize 2
--!native
--!strict
local RS: ReplicatedStorage = game:GetService("ReplicatedStorage")
local Enum = require(RS:WaitForChild("Enum"))

View File

@@ -19,9 +19,8 @@ type CustonEnumsFunctions = {
Remove: (Name: EnumName) -> ()
}
--type MatchList = {
-- [EnumValue]
--}
type MatchResult = any?
type MatchList_f = {[string]: (...any?) -> MatchResult}
local CustomEnum = {} :: CustomEnums
local EnumMeta = {} :: EnumsMetadata
@@ -51,8 +50,9 @@ end
CustomEnum.Enums = setmetatable({}, EnumMeta)
local function EnumMethods(Enum)
function Enum:Match(Result: string, MatchList) --Branch this out later
local Return: any? = nil
--Branch this out later
function Enum:Match(Result: string, MatchList: MatchList_f): MatchResult
local Return: MatchResult = nil
local b: boolean = false
for MatchEnumName, EnumFunc in MatchList do