From 958080727301e050bdaf1c7a2281b9c9e1988033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Thu, 6 Dec 2018 15:37:19 +0800 Subject: =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=87=BD=E6=95=B0=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/matcher/find_lib.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 server/src/matcher/find_lib.lua (limited to 'server/src/matcher/find_lib.lua') 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 -- cgit v1.2.3