summaryrefslogtreecommitdiffstats
path: root/acf2/loader.lua
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-10-08 18:50:56 +0300
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2013-10-08 18:50:56 +0300
commit33728ad3382d74281412d4556561d479bb88832b (patch)
treee8a9b2798dec96d820715f729989e91f9e7d5e12 /acf2/loader.lua
parent3e48dd63e8bdf0c2641cfb73e6b20bea8c466ff8 (diff)
downloadaconf-0.1.0.tar.bz2
aconf-0.1.0.tar.xz
changed module paths from acf to acf2v0.1.0
Diffstat (limited to 'acf2/loader.lua')
-rw-r--r--acf2/loader.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/acf2/loader.lua b/acf2/loader.lua
new file mode 100644
index 0000000..71aeabf
--- /dev/null
+++ b/acf2/loader.lua
@@ -0,0 +1,23 @@
+--[[
+Copyright (c) 2012-2013 Kaarle Ritvanen
+See LICENSE file for license details
+--]]
+
+module(..., package.seeall)
+
+local pth = require('acf2.path')
+
+local posix = require('posix')
+local stringy = require('stringy')
+
+return function(subdir)
+ local comps = pth.split('acf2/'..subdir)
+ local res = {}
+ for _, modfile in ipairs(posix.dir(pth.join(unpack(comps)))) do
+ if stringy.endswith(modfile, '.lua') then
+ local name = modfile:sub(1, -5)
+ res[name] = require(table.concat(comps, '.')..'.'..name)
+ end
+ end
+ return res
+ end