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)
|
||||
end
|
||||
|
||||
local env = {}
|
||||
local temp_global = {}
|
||||
local env = setmetatable({} , { __index = temp_global })
|
||||
local func = {}
|
||||
|
||||
local system = { "init", "exit", "hotfix" }
|
||||
@@ -47,11 +48,15 @@ return function (name , G, loader)
|
||||
env.response = func_id(func, "response")
|
||||
|
||||
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 index then
|
||||
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
|
||||
|
||||
setmetatable(G, { __index = env , __newindex = init_system })
|
||||
@@ -81,5 +86,9 @@ return function (name , G, loader)
|
||||
|
||||
setmetatable(G, nil)
|
||||
|
||||
for k,v in pairs(temp_global) do
|
||||
G[k] = v
|
||||
end
|
||||
|
||||
return func
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user