From 07bd5d0f280b14c51ed17536e9b66b753fb17193 Mon Sep 17 00:00:00 2001 From: Pablo Ariel Mayobre Date: Tue, 14 Feb 2023 18:14:23 -0300 Subject: [PATCH] Fix utils.loadNamespace when passed a table --- concord/utils.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/concord/utils.lua b/concord/utils.lua index 92e19aa..2d3d742 100644 --- a/concord/utils.lua +++ b/concord/utils.lua @@ -21,13 +21,13 @@ end -- @param namespace A table that will hold the required files -- @treturn table The namespace table function Utils.loadNamespace(pathOrFiles, namespace) - if (type(pathOrFiles) ~= "string" and type(pathOrFiles) ~= "table") then + if type(pathOrFiles) ~= "string" and type(pathOrFiles) ~= "table" then error("bad argument #1 to 'loadNamespace' (string/table of strings expected, got "..type(pathOrFiles)..")", 2) end - if (type(pathOrFiles) == "string") then + if type(pathOrFiles) == "string" then local info = love.filesystem.getInfo(pathOrFiles) -- luacheck: ignore - if (info == nil or info.type ~= "directory") then + if info == nil or info.type ~= "directory" then error("bad argument #1 to 'loadNamespace' (path '"..pathOrFiles.."' not found)", 2) end @@ -47,16 +47,16 @@ function Utils.loadNamespace(pathOrFiles, namespace) if namespace then namespace[file] = value end end end - elseif (type(pathOrFiles == "table")) then + elseif type(pathOrFiles) == "table" then for _, path in ipairs(pathOrFiles) do - if (type(path) ~= "string") then + if type(path) ~= "string" then error("bad argument #2 to 'loadNamespace' (string/table of strings expected, got table containing "..type(path)..")", 2) -- luacheck: ignore end local name = path local dotIndex, slashIndex = path:match("^.*()%."), path:match("^.*()%/") - if (dotIndex or slashIndex) then + if dotIndex or slashIndex then name = path:sub((dotIndex or slashIndex) + 1) end