-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager.lua
More file actions
68 lines (68 loc) · 1.31 KB
/
Copy pathmanager.lua
File metadata and controls
68 lines (68 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
local Loader = require('plugins.loader')
local PluginManager
local _class_0
local _base_0 = {
load = function(self, path)
local plugin = self.loader:load(path)
if not plugin then
return nil
end
self.plugins[plugin.name] = plugin
return plugin
end,
unload = function(self, name)
local plugin = self.plugins[name]
if not plugin then
return
end
if plugin.unload then
plugin:unload()
end
self.plugins[name] = nil
end,
getPlugin = function(self, name)
return self.plugins[name]
end,
getAllPlugins = function(self)
return self.plugins
end,
enable = function(self, name)
local plugin = self.plugins[name]
if not plugin then
return
end
if plugin.enable then
return plugin:enable()
end
end,
disable = function(self, name)
local plugin = self.plugins[name]
if not plugin then
return
end
if plugin.disable then
return plugin:disable()
end
end
}
if _base_0.__index == nil then
_base_0.__index = _base_0
end
_class_0 = setmetatable({
__init = function(self)
self.plugins = { }
self.loader = Loader()
end,
__base = _base_0,
__name = "PluginManager"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({ }, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
PluginManager = _class_0
return _class_0