sandbox.protect() now returns as a second value the sandbox's environment

Returning the sandbox's environment to the sandbox caller gives flexibility to invoke functions defined in the caller's scope but using the sandbox's environment.
This commit is contained in:
claudix 2024-03-14 10:48:08 +01:00 committed by GitHub
parent 406161751b
commit dd964ac2bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,7 +172,7 @@ function sandbox.protect(code, options)
if not t[1] then error(t[2]) end if not t[1] then error(t[2]) end
return table.unpack(t, 2, t.n) return table.unpack(t, 2, t.n)
end end, env
end end
-- Public interface: sandbox.run -- Public interface: sandbox.run