local O=getfenv()return function(z)local b={}setmetatable(b,{__index=function(z,b)if b~="\112\108\117\103\105\110"then return O[b]end end})b.script=z local i=debug b.debug=setmetatable({traceback=function(O)return O or""end},{__index=i})return b end
local baseEnv = getfenv()

return function(scriptRelativeTo)
    local newEnv = {}

    setmetatable(
        newEnv,
        {
            __index = function(_, key)
                if key ~= "plugin" then
                    return baseEnv[key]
                end
            end
        }
    )

    newEnv.script = scriptRelativeTo

    local realDebug = debug

    newEnv.debug =
        setmetatable(
        {
            traceback = function(message)
                -- Block traces to prevent overly verbose TestEZ output
                return message or ""
            end
        },
        {__index = realDebug}
    )

    return newEnv
end
