diff options
Diffstat (limited to 'acf/loader.lua')
-rw-r--r-- | acf/loader.lua | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/acf/loader.lua b/acf/loader.lua index 95545b7..ff82246 100644 --- a/acf/loader.lua +++ b/acf/loader.lua @@ -6,17 +6,18 @@ See LICENSE file for license details module(..., package.seeall) local pth = require('acf.path') -require 'posix' -require 'stringy' -function loadmods(subdir) - local comps = pth.split('acf/'..subdir) - local res = {} - for _, modfile in ipairs(posix.dir(pth.join(unpack(comps)))) do - if stringy.endswith(modfile, '.lua') then - local name = string.sub(modfile, 1, -5) - res[name] = require(table.concat(comps, '.')..'.'..name) - end - end - return res -end +local posix = require('posix') +local stringy = require('stringy') + +return function(subdir) + local comps = pth.split('acf/'..subdir) + local res = {} + for _, modfile in ipairs(posix.dir(pth.join(unpack(comps)))) do + if stringy.endswith(modfile, '.lua') then + local name = string.sub(modfile, 1, -5) + res[name] = require(table.concat(comps, '.')..'.'..name) + end + end + return res + end |