Skip to content

Instantly share code, notes, and snippets.

@pauldub
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pauldub/9827791 to your computer and use it in GitHub Desktop.
Save pauldub/9827791 to your computer and use it in GitHub Desktop.
Luvit dnode examples
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)
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