blob: c6f8c63e047eed4ca9e323ce484d8afee07d4082 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
--[[
Copyright (c) 2012-2014 Kaarle Ritvanen
See LICENSE file for license details
--]]
local pth = require('aconf.path')
local posix = require('posix')
local stringy = require('stringy')
return function(subdir)
local comps = pth.split('aconf/'..subdir)
local res = {}
for _, modfile in ipairs(posix.dir(pth.join(table.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
|