服务端例子:(其中Event.Recv.XX中的 XX 可以是任意字符串)
      
function Event.Recv.CS(player,packet)
if packet == "发送数据1" then
local ret_tbl = {
["age"] = 12,
["sex"] = 1,
}
Protocol.PowerSend(player,"发送数据1异步回传",ret_tbl)
end
end
客户端例子:
      
Cli.Send("发送数据1").wait["发送数据1异步回传"] = function (tbl)
Cli.MessageBox(tbl["age"])
end
saveobject = nil;
-- 注册一个窗口打开事件回调
function Event.ViewInit.Test(view)
-- 如果是首次加载
if view.IsInit then
-- 设置以下控件为顶层
view.settop();
-- 往窗口加入一个image控件
view.add(new.image("Test_1"))
return;
end
local object = view.find("Test_1")
object.enable = 1
object.xpos = 10
object.ypos = 10
object.imageID = 100000
object.event = function(object,event)
if event == Cevent.click then
Cli.Send("GETR").wait["RET1"] = function (tbl)
saveobject.imageID = tonumber(tbl["result"])
end
end
end
saveobject = object
end
服务端:
      
function Event.Recv.CS(player,packet)
if packet == "GETR" then
local ret_tbl = {
["result"] = 120000
}
Protocol.PowerSend(player,"RET1",ret_tbl)
end
end