Last active
August 29, 2015 13:57
-
-
Save pauldub/9827791 to your computer and use it in GitHub Desktop.
Luvit dnode examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local dnode = require('.') | |
local utils = require('utils') | |
dnode:connect(7070, function(remote, conn) | |
print(utils.dump(remote)) | |
remote.zing(33, function(n) | |
print('n='..n) | |
end) | |
remote.greet("welcome", "paul", function(greetings) | |
print('server greetings: ' .. greetings) | |
end) | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local dnode = require('.') | |
dnode:listen(function(remote, conn) | |
return { | |
zing = function(n, cb) | |
print("zing called with:", n) | |
cb(n * 100) | |
end, | |
greet = function(greeting, name, cb) | |
cb(greeting .. ' ' .. name .. ', nice to meet you, I\'m the server.') | |
end | |
} | |
end ,7070) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment