This commit is contained in:
siduck
2021-11-13 21:59:31 +05:30
parent fd668e559e
commit c8a27d701c
6 changed files with 10 additions and 74 deletions

View File

@@ -1,22 +1,5 @@
local function isModuleAvailable(name)
if package.loaded[name] then
return true
else
for _, searcher in ipairs(package.searchers or package.loaders) do
local loader = searcher(name)
if type(loader) == "function" then
package.preload[name] = loader
return true
end
end
return false
end
end
local moduleExists = pcall(require, "custom")
local loadIfExists = function(module)
if isModuleAvailable(module) then
require(module)
end
if moduleExists then
require "custom"
end
loadIfExists "custom"