From dd964ac2bbc508a1734ceca4c9f52e2d0ef1f37c Mon Sep 17 00:00:00 2001 From: claudix Date: Thu, 14 Mar 2024 10:48:08 +0100 Subject: [PATCH] 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. --- sandbox.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox.lua b/sandbox.lua index 6b5edd1..5f0f1c2 100644 --- a/sandbox.lua +++ b/sandbox.lua @@ -172,7 +172,7 @@ function sandbox.protect(code, options) if not t[1] then error(t[2]) end return table.unpack(t, 2, t.n) - end + end, env end -- Public interface: sandbox.run