mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
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.
This commit is contained in:
2
init.lua
2
init.lua
@@ -6,6 +6,8 @@ local LIBRARY = 'pe-lualib'
|
|||||||
local SERVICE = IsDuplicityVersion() and 'server' or 'client'
|
local SERVICE = IsDuplicityVersion() and 'server' or 'client'
|
||||||
local IMPORTS = {}
|
local IMPORTS = {}
|
||||||
|
|
||||||
|
lib = exports[LIBRARY]
|
||||||
|
|
||||||
local function LoadFile(file)
|
local function LoadFile(file)
|
||||||
local dir = ('imports/%s'):format(file)
|
local dir = ('imports/%s'):format(file)
|
||||||
local chunk = LoadResourceFile(LIBRARY, ('%s/%s.lua'):format(dir, SERVICE))
|
local chunk = LoadResourceFile(LIBRARY, ('%s/%s.lua'):format(dir, SERVICE))
|
||||||
|
|||||||
8
resource/main.lua
Normal file
8
resource/main.lua
Normal file
@@ -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
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user