summaryrefslogtreecommitdiff
path: root/server/src/matcher/find_lib.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2018-12-06 15:37:19 +0800
committer最萌小汐 <sumneko@hotmail.com>2018-12-06 15:37:19 +0800
commit958080727301e050bdaf1c7a2281b9c9e1988033 (patch)
tree0f35644d6f6e10025a3d01cf16425c149bb4d919 /server/src/matcher/find_lib.lua
parentf85f60c41a33ea562081d19aeba64fbe4400d905 (diff)
downloadlua-language-server-958080727301e050bdaf1c7a2281b9c9e1988033.zip
一些函数定义
Diffstat (limited to 'server/src/matcher/find_lib.lua')
-rw-r--r--server/src/matcher/find_lib.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/server/src/matcher/find_lib.lua b/server/src/matcher/find_lib.lua
new file mode 100644
index 00000000..968f5cf2
--- /dev/null
+++ b/server/src/matcher/find_lib.lua
@@ -0,0 +1,22 @@
+local lni = require 'lni'
+
+local Libs
+local function getLibs()
+ if Libs then
+ return Libs
+ end
+ Libs = {}
+ for path in io.scan(ROOT / 'libs') do
+ local buf = io.load(path)
+ if buf then
+ lni.classics(buf, path:string(), {Libs})
+ end
+ end
+ return Libs
+end
+
+return function (var)
+ local key = var.key
+ local libs = getLibs()
+ return libs[key]
+end