fixed indentation
This commit is contained in:
@@ -1,28 +1,28 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.setup(module, opts)
|
function M.setup(module, opts)
|
||||||
local instance = nil
|
local instance = nil
|
||||||
|
|
||||||
local function setup()
|
local function setup()
|
||||||
if instance == nil then
|
if instance == nil then
|
||||||
instance = require(module)
|
instance = require(module)
|
||||||
if instance.setup then
|
if instance.setup then
|
||||||
instance.setup(opts or {})
|
instance.setup(opts or {})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
return setmetatable({}, {
|
return setmetatable({}, {
|
||||||
__index = function(_, key)
|
__index = function(_, key)
|
||||||
setup()
|
setup()
|
||||||
return instance[key]
|
return instance[key]
|
||||||
end,
|
end,
|
||||||
|
|
||||||
__call = function(_, ...)
|
__call = function(_, ...)
|
||||||
setup()
|
setup()
|
||||||
return instance(...)
|
return instance(...)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
Reference in New Issue
Block a user