remote object

This commit is contained in:
云风
2012-08-29 14:33:24 +08:00
parent 9dc2c041b4
commit 33bde97b66
13 changed files with 378 additions and 207 deletions

24
service/testrobj.lua Normal file
View File

@@ -0,0 +1,24 @@
local skynet = require "skynet"
skynet.remote_service()
local obj = { id = 0 }
function obj.hello()
return "Hello"
end
function obj:inc()
self.id = self.id + 1
return self.id
end
skynet.start(function()
skynet.remote_create(obj)
local root = skynet.remote_root()
print(root.echo("hello"))
root.register("test",obj)
local qobj = root.query "test"
print(qobj.hello())
print(qobj:inc())
end)