summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-03 09:53:39 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-03 09:53:39 +0800
commita86ddc73a90586b03d3498d93a08c0533bbe24b8 (patch)
treee50696277f7eef458a145cf0d3a8fcee1863b4cb /server/src
parent79244d8d55115540011fd2bc742f02b4da4c39c7 (diff)
downloadlua-language-server-a86ddc73a90586b03d3498d93a08c0533bbe24b8.zip
已定义全局变量使用表
Diffstat (limited to 'server/src')
-rw-r--r--server/src/config.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/server/src/config.lua b/server/src/config.lua
index 9e4ae296..c69df6ad 100644
--- a/server/src/config.lua
+++ b/server/src/config.lua
@@ -7,14 +7,23 @@ end
local function Str2Hash(sep)
return function (v)
- if type(v) ~= 'string' then
- return false
+ if type(v) == 'string' then
+ local t = {}
+ for s in v:gmatch('[^'..sep..']+') do
+ t[s] = true
+ end
+ return true, t
end
- local t = {}
- for s in v:gmatch('[^'..sep..']+') do
- t[s] = true
+ if type(v) == 'table' then
+ local t = {}
+ for _, s in ipairs(v) do
+ if type(s) == 'string' then
+ t[s] = true
+ end
+ end
+ return true, t
end
- return true, t
+ return false
end
end