mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 06:56:03 +01:00
refactor(init): return a stub for imports with no return
Modules that define globals or directly add several functions to the lib namespace currently need to return empty functions (i.e. locales).
This commit is contained in:
6
init.lua
6
init.lua
@@ -47,7 +47,8 @@ local function loadModule(self, module)
|
||||
if err then
|
||||
error(('\n^1Error importing module (%s): %s^0'):format(dir, err), 3)
|
||||
else
|
||||
rawset(self, module, chunk())
|
||||
local result = chunk() or function() end
|
||||
rawset(self, module, result)
|
||||
return self[module]
|
||||
end
|
||||
end
|
||||
@@ -90,9 +91,6 @@ lib = setmetatable({
|
||||
}, {
|
||||
__index = call,
|
||||
__call = call,
|
||||
__newindex = function()
|
||||
error('Cannot set index on lib')
|
||||
end,
|
||||
})
|
||||
|
||||
local intervals = {}
|
||||
|
||||
Reference in New Issue
Block a user