mirror of
https://github.com/Keyslam-Group/Concord.git
synced 2025-09-04 13:23:54 -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)
|
||||
|
||||
for _, file in ipairs(files) do
|
||||
local name = file:sub(1, #file - 4)
|
||||
local path = pathOrFiles.."."..name
|
||||
if 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
|
||||
local value = require(path)
|
||||
if namespace then namespace[name] = value end
|
||||
end
|
||||
end
|
||||
elseif type(pathOrFiles) == "table" then
|
||||
for _, path in ipairs(pathOrFiles) do
|
||||
|
@ -65,4 +67,4 @@ function Utils.loadNamespace(pathOrFiles, namespace)
|
|||
return namespace
|
||||
end
|
||||
|
||||
return Utils
|
||||
return Utils
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue