diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2018-12-06 15:37:19 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2018-12-06 15:37:19 +0800 |
commit | 958080727301e050bdaf1c7a2281b9c9e1988033 (patch) | |
tree | 0f35644d6f6e10025a3d01cf16425c149bb4d919 /server/src/matcher/find_lib.lua | |
parent | f85f60c41a33ea562081d19aeba64fbe4400d905 (diff) | |
download | lua-language-server-958080727301e050bdaf1c7a2281b9c9e1988033.zip |
一些函数定义
Diffstat (limited to 'server/src/matcher/find_lib.lua')
-rw-r--r-- | server/src/matcher/find_lib.lua | 22 |
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 |