Created
November 27, 2014 03:31
-
-
Save akirayu101/d0fc7bbaf1737f68e6f2 to your computer and use it in GitHub Desktop.
simple_lua_rpc
This file contains hidden or 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
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