1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-17 08:47:39 +00:00

check for recursive requires + Lua update

This commit is contained in:
kepler155c@gmail.com
2019-02-08 21:02:41 -05:00
parent 8c1abb21ca
commit 195dbd365a
3 changed files with 46 additions and 35 deletions

View File

@@ -89,14 +89,21 @@ return function(env)
end
local function loadedSearcher(modname)
if env.package.loaded[modname] then
if env.package.loaded[modname] then
return function()
return env.package.loaded[modname]
end
end
end
local sentinel = { }
local function pathSearcher(modname)
if env.package.loaded[modname] == sentinel then
error("loop or previous error loading module '" .. modname .. "'", 0)
end
env.package.loaded[modname] = sentinel
local fname = modname:gsub('%.', '/')
for pattern in string.gmatch(env.package.path, "[^;]+") do