diff options
author | Steven Barth <steven@midlink.org> | 2008-08-29 12:27:54 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-29 12:27:54 +0000 |
commit | bda994c32e8afda1cac2e0e4ae4c66c50d82c3f1 (patch) | |
tree | b3c74f5f020a3a51313bcdc3a5fc4e28c362e40a /modules/rpc/luasrc/jsonrpc.lua | |
parent | 5778eae3693aff665eb0d1d384af31c1d1008386 (diff) |
Completed first version of JSON-RPC API
Diffstat (limited to 'modules/rpc/luasrc/jsonrpc.lua')
-rw-r--r-- | modules/rpc/luasrc/jsonrpc.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/rpc/luasrc/jsonrpc.lua b/modules/rpc/luasrc/jsonrpc.lua index 1c0db8bce..71c95d549 100644 --- a/modules/rpc/luasrc/jsonrpc.lua +++ b/modules/rpc/luasrc/jsonrpc.lua @@ -44,9 +44,10 @@ function handle(tbl, rawsource, ...) if stat then if type(json.method) == "string" and (not json.params or type(json.params) == "table") then - if tbl[json.method] then + local method = resolve(tbl, json.method) + if method then response = reply(json.jsonrpc, json.id, - proxy(resolve(tbl, json.method), unpack(json.params or {}))) + proxy(method, unpack(json.params or {}))) else response = reply(json.jsonrpc, json.id, nil, {code=-32601, message="Method not found."}) @@ -90,4 +91,4 @@ function proxy(method, ...) return res end end -end
\ No newline at end of file +end |