skynet.pcall support vararg; sharedata loader can use custom args

This commit is contained in:
David Feng
2016-04-27 20:53:05 +08:00
parent 4924c6d30b
commit 45d46b9072
3 changed files with 12 additions and 12 deletions

View File

@@ -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)