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}"`) warn(`{self.Model}: Door tag was present but couldnt specify its type for use "{TagName}"`)
end end
}) })
print(`{self.Model}: created a ProximityPrompt @ "{Inst:GetFullName()}"`) print(`{self.Model}: created a ProximityPrompt @ "{Inst:GetFullName()}"`)
end end

View File

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