mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
remove snax global set limit
This commit is contained in:
@@ -31,7 +31,8 @@ return function (name , G, loader)
|
|||||||
assert(G.response == nil)
|
assert(G.response == nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
local env = {}
|
local temp_global = {}
|
||||||
|
local env = setmetatable({} , { __index = temp_global })
|
||||||
local func = {}
|
local func = {}
|
||||||
|
|
||||||
local system = { "init", "exit", "hotfix" }
|
local system = { "init", "exit", "hotfix" }
|
||||||
@@ -47,11 +48,15 @@ return function (name , G, loader)
|
|||||||
env.response = func_id(func, "response")
|
env.response = func_id(func, "response")
|
||||||
|
|
||||||
local function init_system(t, name, f)
|
local function init_system(t, name, f)
|
||||||
local index = assert(system[name] , string.format("Not support global var %s", name))
|
local index = system[name]
|
||||||
if type(f) ~= "function" then
|
if index then
|
||||||
error (string.format("%s must be a function", name))
|
if type(f) ~= "function" then
|
||||||
|
error (string.format("%s must be a function", name))
|
||||||
|
end
|
||||||
|
func[index][4] = f
|
||||||
|
else
|
||||||
|
temp_global[name] = f
|
||||||
end
|
end
|
||||||
func[index][4] = f
|
|
||||||
end
|
end
|
||||||
|
|
||||||
setmetatable(G, { __index = env , __newindex = init_system })
|
setmetatable(G, { __index = env , __newindex = init_system })
|
||||||
@@ -81,5 +86,9 @@ return function (name , G, loader)
|
|||||||
|
|
||||||
setmetatable(G, nil)
|
setmetatable(G, nil)
|
||||||
|
|
||||||
|
for k,v in pairs(temp_global) do
|
||||||
|
G[k] = v
|
||||||
|
end
|
||||||
|
|
||||||
return func
|
return func
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user