Normalize slashes to dots when requiring in Utils.loadNamespace

This commit is contained in:
Pablo Mayobre 2023-02-14 22:18:59 -03:00
parent 75c35d986a
commit 7d8e46ea1f
No known key found for this signature in database
GPG key ID: 13A2F589D013E0E7

View file

@ -44,7 +44,7 @@ function Utils.loadNamespace(pathOrFiles, namespace)
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:gsub("%/", "."))
if namespace then namespace[name] = value end if namespace then namespace[name] = value end
end end
end end
@ -61,7 +61,7 @@ function Utils.loadNamespace(pathOrFiles, namespace)
name = path:sub((dotIndex or slashIndex) + 1) name = path:sub((dotIndex or slashIndex) + 1)
end end
local value = require(path) local value = require(path:gsub("%/", "."))
if namespace then namespace[name] = value end if namespace then namespace[name] = value end
end end
end end