diff options
author | 2016-02-21 11:48:45 +0100 | |
---|---|---|
committer | 2016-02-21 11:48:45 +0100 | |
commit | cc24a339d8c0517259084b5c178d784626ba965c (patch) | |
tree | 9868e9687b5802ae0a3733712a3bbeb3bc75c953 /plugins/boot.lua | |
parent | b5daabda5495dea5c50e17961ecfed2ea8619d76 (diff) |
Merge remote-tracking branch 'refs/remotes/mamedev/master'
Second attempt
Diffstat (limited to 'plugins/boot.lua')
-rw-r--r-- | plugins/boot.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/plugins/boot.lua b/plugins/boot.lua new file mode 100644 index 00000000000..4f8c6a0ee96 --- /dev/null +++ b/plugins/boot.lua @@ -0,0 +1,24 @@ +require('lfs') +local uv = require('luv') +local cwd = uv.cwd() +package.path = cwd .. "/plugins/?.lua;" .. cwd .. "/plugins/?/init.lua" + +local json = require('json') +function readAll(file) + local f = io.open(file, "rb") + local content = f:read("*all") + f:close() + return content +end + +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 + |