From 52a3623e0ee5d1a5b1ecaf4e0fa174f44bd820ab Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Tue, 16 Nov 2021 11:15:34 +1100 Subject: [PATCH] feat: add lib table for exports Anything assigned to the table will be exported; it's just a hacky way to provide support for Lua Language Server. --- init.lua | 2 ++ resource/main.lua | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 resource/main.lua diff --git a/init.lua b/init.lua index 6bd5e65..01b5c84 100644 --- a/init.lua +++ b/init.lua @@ -6,6 +6,8 @@ local LIBRARY = 'pe-lualib' local SERVICE = IsDuplicityVersion() and 'server' or 'client' local IMPORTS = {} +lib = exports[LIBRARY] + local function LoadFile(file) local dir = ('imports/%s'):format(file) local chunk = LoadResourceFile(LIBRARY, ('%s/%s.lua'):format(dir, SERVICE)) diff --git a/resource/main.lua b/resource/main.lua new file mode 100644 index 0000000..b021e9d --- /dev/null +++ b/resource/main.lua @@ -0,0 +1,8 @@ +-- Creates exports from values assigned to lib. +-- Hacky workaround for Lua Language Server support. + +lib = setmetatable({}, { + __newindex = function(self, name, fn) + exports(name, fn) + end +}) \ No newline at end of file