mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
feat(init): importing modules with resource metadata
Allow loading modules through fxmanifest (i.e. ox_lib 'locale' or ox_libs { 'locale' }).
Useful in some cases where the module needs to be loaded (lib.locale()) first.
This commit is contained in:
10
init.lua
10
init.lua
@@ -218,3 +218,13 @@ else
|
|||||||
TriggerClientEvent(notifyEvent, playerId, data)
|
TriggerClientEvent(notifyEvent, playerId, data)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
for i = 1, GetNumResourceMetadata(cache.resource, 'ox_lib') do
|
||||||
|
local name = GetResourceMetadata(cache.resource, 'ox_lib', i - 1)
|
||||||
|
|
||||||
|
if not rawget(lib, name) then
|
||||||
|
local module = loadModule(lib, name)
|
||||||
|
|
||||||
|
if type(module) == 'function' then pcall(module) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user