mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-07 06:37:50 -04:00
parent
6379092642
commit
d6bd0de564
1 changed files with 7 additions and 5 deletions
|
@ -38,11 +38,13 @@ function Utils.loadNamespace(pathOrFiles, namespace)
|
||||||
local files = love.filesystem.getDirectoryItems(pathOrFiles)
|
local files = love.filesystem.getDirectoryItems(pathOrFiles)
|
||||||
|
|
||||||
for _, file in ipairs(files) do
|
for _, file in ipairs(files) do
|
||||||
local name = file:sub(1, #file - 4)
|
if string.match(file, '%.lua$') ~= nil then
|
||||||
local path = pathOrFiles.."."..name
|
local name = file:sub(1, #file - 4)
|
||||||
|
local path = pathOrFiles.."."..name
|
||||||
|
|
||||||
local value = require(path)
|
local value = require(path)
|
||||||
if namespace then namespace[name] = value end
|
if namespace then namespace[name] = value end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif type(pathOrFiles) == "table" then
|
elseif type(pathOrFiles) == "table" then
|
||||||
for _, path in ipairs(pathOrFiles) do
|
for _, path in ipairs(pathOrFiles) do
|
||||||
|
@ -65,4 +67,4 @@ function Utils.loadNamespace(pathOrFiles, namespace)
|
||||||
return namespace
|
return namespace
|
||||||
end
|
end
|
||||||
|
|
||||||
return Utils
|
return Utils
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue