From 26553beec76912048e0ca12a2e052d6e966b2ecd Mon Sep 17 00:00:00 2001 From: eskerda Date: Thu, 7 Jan 2021 17:12:10 +0100 Subject: [PATCH] fix(sandbox) fix false on passed_env passed_env[k] = false would set BASE_ENV[k] --- sandbox.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sandbox.lua b/sandbox.lua index d40084d..ce345f8 100644 --- a/sandbox.lua +++ b/sandbox.lua @@ -134,7 +134,11 @@ function sandbox.protect(code, options) local env = {} for k, v in pairs(BASE_ENV) do local pv = passed_env[k] - env[k] = pv ~= nil and pv or v + if pv ~= nil then + env[k] = pv + else + env[k] = v + end end setmetatable(env, { __index = options.env }) env._G = env