diff --git a/src/main.lua b/src/main.lua index 714d132..471320f 100644 --- a/src/main.lua +++ b/src/main.lua @@ -3,19 +3,14 @@ local fennel = require("lib.fennel") local make_love_searcher = function(env) return function(module_name) - local path = module_name:gsub("%.", "/") .. ".fnl" - if love.filesystem.getInfo(path) then - return function(...) - local code = love.filesystem.read(path) - return fennel.eval(code, {env=env, filename=path}, ...) - end, path - end - path = module_name:gsub("%.", "/") .. "/init.fnl" - if love.filesystem.getInfo(path) then - return function(...) - local code = love.filesystem.read(path) - return fennel.eval(code, {env=env, filename=path}, ...) - end, path + for _, filename in ipairs({".fnl", "/init.fnl"}) do + local path = module_name:gsub("%.", "/") .. filename + if love.filesystem.getInfo(path) then + return function(...) + local code = love.filesystem.read(path) + return fennel.eval(code, {env=env, filename=path}, ...) + end + end end end end