Skip to content

Commit

Permalink
Fix issue with FindService erroring
Browse files Browse the repository at this point in the history
  • Loading branch information
Quenty committed Jan 25, 2018
1 parent 696242c commit 8968404
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/Converter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ Converter.ApiSettingCacheName = "AnaminusAPICache"
Converter.MaxCacheSettingsTime = 60*60*24 -- 1 day
Converter.SearchCache = false -- TODO: Try enabling cache
Converter.ServiceNameMap = setmetatable({}, {
__index = function(self, ClassName)
local IsService = ClassName:find("Service$")
or ClassName:find("Provider$")
or ClassName:find("Settings$")
or game:FindService(ClassName)

self[ClassName] = IsService
return IsService
__index = function(self, className)
local isService = className:find("Service$")
or className:find("Provider$")
or className:find("Settings$")

if not isService then
-- Try to find the service
pcall(function()
isService = game:FindService(className)
end)
end

self[className] = isService
return isService
end
})

Expand Down

0 comments on commit 8968404

Please sign in to comment.