pure lua compatiblity fixes for moonlight, busted, etc

This commit is contained in:
kepler155c@gmail.com
2020-06-09 18:16:51 -06:00
parent 039fa73749
commit e9580d67eb
8 changed files with 133 additions and 73 deletions

View File

@@ -596,7 +596,6 @@ function Util.loadUrl(url, env) -- loadfile equivalent
end
function Util.runUrl(env, url, ...) -- os.run equivalent
setmetatable(env, { __index = _G })
local fn, m = Util.loadUrl(url, env)
if fn then
return pcall(fn, ...)
@@ -606,7 +605,6 @@ end
function Util.run(env, path, ...)
if type(env) ~= 'table' then error('Util.run: env must be a table', 2) end
setmetatable(env, { __index = _G })
local fn, m = loadfile(path, env)
if fn then
return pcall(fn, ...)
@@ -616,7 +614,6 @@ end
function Util.runFunction(env, fn, ...)
setfenv(fn, env)
setmetatable(env, { __index = _G })
return pcall(fn, ...)
end