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,12 +38,14 @@ 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
|
||||||
|
if string.match(file, '%.lua$') ~= nil then
|
||||||
local name = file:sub(1, #file - 4)
|
local name = file:sub(1, #file - 4)
|
||||||
local path = pathOrFiles.."."..name
|
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
|
||||||
if type(path) ~= "string" then
|
if type(path) ~= "string" then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue