Skip to content

Instantly share code, notes, and snippets.

@akirayu101
Created November 27, 2014 03:31
Show Gist options
  • Save akirayu101/d0fc7bbaf1737f68e6f2 to your computer and use it in GitHub Desktop.
Save akirayu101/d0fc7bbaf1737f68e6f2 to your computer and use it in GitHub Desktop.
simple_lua_rpc
rpc_lua = {}
function rpc_lua:call(fn_name, ...)
return self[fn_name](self, ...)
end
function rpc_lua:test1(arg1, arg2, arg3)
print "test1"
end
function rpc_lua:test2(arg1, arg2)
print "test2"
end
rpc_server = {}
local function rpc_server_index(o, key)
rawset(o, key, function(...) print(key) print(...) end)
return o[key]
end
setmetatable(rpc_server, {__index = rpc_server_index})
rpc_server.funca(1,2,3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment