skynet.dispatch can replace old func

This commit is contained in:
Cloud Wu
2015-07-29 16:12:49 +08:00
parent b3f966bcaa
commit 4cbead28d5

View File

@@ -417,8 +417,9 @@ end
function skynet.dispatch(typename, func) function skynet.dispatch(typename, func)
local p = proto[typename] local p = proto[typename]
if func then if func then
assert(p and (p.dispatch == nil), tostring(typename)) local ret = p.dispatch
p.dispatch = func p.dispatch = func
return ret
else else
return p and p.dispatch return p and p.dispatch
end end