Ignore non-lua files in Utils.loadNamespace

Fixes #48
This commit is contained in:
Pablo Ariel Mayobre 2023-02-14 18:18:41 -03:00 committed by Pablo Mayobre
parent 95c6a5e085
commit 7b1df11cfb
No known key found for this signature in database
GPG key ID: 13A2F589D013E0E7

View file

@ -40,15 +40,12 @@ function Utils.loadNamespace(pathOrFiles, namespace)
for _, file in ipairs(files) do
local isFile = love.filesystem.getInfo(pathOrFiles .. "/" .. file).type == "file"
if isFile then
if isFile and string.match(file, '%.lua$') ~= nil then
local name = file:sub(1, #file - 4)
local path = pathOrFiles.."."..name
local value = require(path)
if namespace then namespace[name] = value end
else
local value = require(pathOrFiles.."."..file)
if namespace then namespace[file] = value end
end
end
elseif type(pathOrFiles) == "table" then