set _ENV to metatable when shadredatad read file

This commit is contained in:
Cloud Wu
2014-09-18 18:27:57 +08:00
parent bac9348db9
commit f8bf05513c

View File

@@ -32,15 +32,18 @@ end
local CMD = {}
local env_mt = { __index = _ENV }
function CMD.new(name, t)
local dt = type(t)
local value
if dt == "table" then
value = t
elseif dt == "string" then
value = {}
value = setmetatable({}, env_mt)
local f = load(t, "=" .. name, "t", value)
f()
setmetatable(value, nil)
elseif dt == "nil" then
value = {}
else