mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
fix(resource): don't export internally loaded modules
i.e. exports.ox_lib:callback is invalid
This commit is contained in:
@@ -30,7 +30,7 @@ files {
|
|||||||
'locales/*.json',
|
'locales/*.json',
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_script 'resource/main.lua'
|
shared_script 'resource/init.lua'
|
||||||
|
|
||||||
shared_scripts {
|
shared_scripts {
|
||||||
'resource/**/shared.lua',
|
'resource/**/shared.lua',
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
|
local debug_getinfo = debug.getinfo
|
||||||
|
|
||||||
lib = setmetatable({
|
lib = setmetatable({
|
||||||
name = 'ox_lib',
|
name = 'ox_lib',
|
||||||
context = IsDuplicityVersion() and 'server' or 'client',
|
context = IsDuplicityVersion() and 'server' or 'client',
|
||||||
}, {
|
}, {
|
||||||
__newindex = function(self, name, fn)
|
__newindex = function(self, name, fn)
|
||||||
exports(name, fn)
|
rawset(self, name, fn)
|
||||||
rawset(self, name, fn)
|
|
||||||
end
|
if debug_getinfo(2, 'S').short_src:find('@ox_lib/resource') then
|
||||||
|
exports(name, fn)
|
||||||
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
cache = {
|
cache = {
|
||||||
resource = lib.name
|
resource = lib.name
|
||||||
}
|
}
|
||||||
|
|
||||||
if not LoadResourceFile(lib.name, 'web/build/index.html') then
|
if not LoadResourceFile(lib.name, 'web/build/index.html') then
|
||||||
local err = '^1Unable to load UI. Build ox_lib or download the latest release.\n ^3https://github.com/overextended/ox_lib/releases/latest/download/ox_lib.zip^0'
|
local err = '^1Unable to load UI. Build ox_lib or download the latest release.\n ^3https://github.com/overextended/ox_lib/releases/latest/download/ox_lib.zip^0'
|
||||||
function lib.hasLoaded() return err end
|
function lib.hasLoaded() return err end
|
||||||
error(err)
|
|
||||||
|
error(err)
|
||||||
end
|
end
|
||||||
|
|
||||||
function lib.hasLoaded() return true end
|
function lib.hasLoaded() return true end
|
||||||
Reference in New Issue
Block a user