Allow passing environment table to import function

This commit is contained in:
Jordan Irwin 2021-08-09 11:59:51 -07:00
parent f67a593ab4
commit 0e7f307d03
No known key found for this signature in database
GPG Key ID: E3E358C2F44C290A
1 changed files with 15 additions and 2 deletions

View File

@ -257,8 +257,21 @@ local ldoc_contents = {
} }
if args.UNSAFE_NO_SANDBOX then if args.UNSAFE_NO_SANDBOX then
function ldoc.import(t) local select_locals = {
return _G[t] ["args"] = args,
}
function ldoc.import(t, env)
local retval = select_locals[t]
if not retval then
retval = _G[t]
end
if env then
env[t] = retval
end
return retval
end end
table.insert(ldoc_contents, 'import') table.insert(ldoc_contents, 'import')