mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
skynet.pcall support vararg; sharedata loader can use custom args
This commit is contained in:
@@ -38,7 +38,7 @@ local CMD = {}
|
||||
|
||||
local env_mt = { __index = _ENV }
|
||||
|
||||
function CMD.new(name, t)
|
||||
function CMD.new(name, t, ...)
|
||||
local dt = type(t)
|
||||
local value
|
||||
if dt == "table" then
|
||||
@@ -51,7 +51,7 @@ function CMD.new(name, t)
|
||||
else
|
||||
f = assert(load(t, "=" .. name, "bt", value))
|
||||
end
|
||||
local _, ret = assert(skynet.pcall(f))
|
||||
local _, ret = assert(skynet.pcall(f, ...))
|
||||
setmetatable(value, nil)
|
||||
if type(ret) == "table" then
|
||||
value = ret
|
||||
@@ -90,7 +90,7 @@ function CMD.confirm(cobj)
|
||||
return NORET
|
||||
end
|
||||
|
||||
function CMD.update(name, t)
|
||||
function CMD.update(name, t, ...)
|
||||
local v = pool[name]
|
||||
local watch, oldcobj
|
||||
if v then
|
||||
@@ -101,7 +101,7 @@ function CMD.update(name, t)
|
||||
pool[name] = nil
|
||||
pool_count[name] = nil
|
||||
end
|
||||
CMD.new(name, t)
|
||||
CMD.new(name, t, ...)
|
||||
local newobj = pool[name].obj
|
||||
if watch then
|
||||
sharedata.host.markdirty(oldcobj)
|
||||
|
||||
Reference in New Issue
Block a user