From c5393d339bc5a67840158f5ab1c659de632278d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 20 Nov 2018 18:50:42 +0800 Subject: =?UTF-8?q?=E5=8F=AF=E9=80=89=E5=8D=8F=E8=AE=AE=E4=B8=8D=E6=8A=9B?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/service.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/src/service.lua b/server/src/service.lua index 46a9ca37..c1cf7f2c 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -28,6 +28,11 @@ local function listen(self, input, output) io.write(buf) end) session:start(function (method, params) + local optional + if method:sub(1, 2) == '$/' then + method = method:sub(3) + optional = true + end local f = Method[method] if f then local suc, res, res2 = pcall(f, session, params) @@ -37,7 +42,11 @@ local function listen(self, input, output) return nil, '发生运行时错误:' .. res end end - return nil, '没有注册方法:' .. method + if optional then + return false + else + return nil, '没有注册方法:' .. method + end end) end -- cgit v1.2.3