2016-02-14 19:48:44 +01:00
|
|
|
require('lfs')
|
2016-03-05 07:56:50 +01:00
|
|
|
local cwd = lfs.currentdir()
|
2016-02-14 10:58:18 +01:00
|
|
|
package.path = cwd .. "/plugins/?.lua;" .. cwd .. "/plugins/?/init.lua"
|
|
|
|
|
2016-02-14 19:48:44 +01:00
|
|
|
local json = require('json')
|
|
|
|
function readAll(file)
|
|
|
|
local f = io.open(file, "rb")
|
|
|
|
local content = f:read("*all")
|
|
|
|
f:close()
|
|
|
|
return content
|
|
|
|
end
|
2016-02-14 10:58:18 +01:00
|
|
|
|
2016-02-14 19:48:44 +01:00
|
|
|
for file in lfs.dir("plugins") do
|
|
|
|
if (file~="." and file~=".." and lfs.attributes("plugins/" .. file,"mode")=="directory") then
|
|
|
|
local filename = "plugins/" .. file .. "/plugin.json"
|
|
|
|
local meta = json.parse(readAll(filename))
|
|
|
|
if (meta["plugin"]["type"]=="plugin") and (meta["plugin"]["start"]=="true") then
|
|
|
|
server = require(meta["plugin"]["name"])
|
|
|
|
server.startplugin();
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2016-02-14 10:58:18 +01:00
|
|
|
|