work on enum system

This commit is contained in:
2024-03-20 14:41:37 -04:00
parent 574569442e
commit bda232e337
2 changed files with 6 additions and 10 deletions

View File

@@ -144,7 +144,6 @@ function ButtonsModule:CreatePromptButtons()
warn(`{self.Model}: Door tag was present but couldnt specify its type for use "{TagName}"`)
end
})
print(`{self.Model}: created a ProximityPrompt @ "{Inst:GetFullName()}"`)
end

View File

@@ -53,22 +53,19 @@ CustomEnum.Enums = setmetatable({}, EnumMeta)
local function EnumMethods(Enum)
--Branch these out later
function Enum:Match(Result: string, MatchList: MatchList_f): MatchResult
local Return: MatchResult = nil
local LastIndexName, LastIndexValue = next(MatchList)
for MatchEnumName: string, EnumFunc in MatchList do
if MatchEnumName == Result then
Return = type(EnumFunc) == "function" and EnumFunc() or EnumFunc
break
return type(EnumFunc) == "function" and EnumFunc() or EnumFunc
elseif MatchEnumName == LastIndexName and LastIndexValue ~= nil and MatchList['_'] then
return type(MatchList['_']) == "function" and MatchList['_']() or MatchList['_']
end
end
if Return ~= nil and MatchList["_"] then
Return = MatchList["_"]()
end
return Return
return nil
end
function Enum:MatchThread(Result: string, MatchList: MatchList_f): (boolean, MatchResult)
task.synchronize()
function Enum:MatchOnThread(Result: string, MatchList: MatchList_f): (boolean, MatchResult)
return coroutine.resume(coroutine.create(function()
return self:Match(Result, MatchList)
end))