refactor(resource): load extra modules

This commit is contained in:
Linden
2024-04-01 19:15:04 +11:00
parent 989462da7d
commit 09ca963f26
3 changed files with 25 additions and 19 deletions

View File

@@ -1,21 +1,24 @@
--[[ FX Information ]]--
fx_version 'cerulean'
--[[ FX Information ]]
--
fx_version 'cerulean'
use_experimental_fxv2_oal 'yes'
lua54 'yes'
games { 'rdr3', 'gta5' }
lua54 'yes'
games { 'rdr3', 'gta5' }
rdr3_warning 'I acknowledge that this is a prerelease build of RedM, and I am aware my resources *will* become incompatible once RedM ships.'
--[[ Resource Information ]]--
name 'ox_lib'
author 'Overextended'
version '3.18.0'
license 'LGPL-3.0-or-later'
repository 'https://github.com/overextended/ox_lib'
description 'A library of shared functions to utilise in other resources.'
--[[ Resource Information ]]
--
name 'ox_lib'
author 'Overextended'
version '3.18.0'
license 'LGPL-3.0-or-later'
repository 'https://github.com/overextended/ox_lib'
description 'A library of shared functions to utilise in other resources.'
--[[ Manifest ]]--
--[[ Manifest ]]
--
dependencies {
'/server:7290',
'/server:7290',
'/onesync',
}
@@ -23,17 +26,19 @@ ui_page 'web/build/index.html'
files {
'init.lua',
'resource/settings.lua',
'imports/**/client.lua',
'imports/**/shared.lua',
'web/build/index.html',
'web/build/**/*',
'locales/*.json',
'locales/*.json',
}
shared_script 'resource/init.lua'
shared_scripts {
'resource/**/shared.lua',
'imports/require/shared.lua',
-- 'resource/**/shared/*.lua'
}
@@ -43,8 +48,8 @@ client_scripts {
}
server_scripts {
'imports/callback/server.lua',
'imports/callback/server.lua',
'imports/getFilesInDirectory/server.lua',
'resource/**/server.lua',
'resource/**/server/*.lua',
}

View File

@@ -108,7 +108,7 @@ end
---Loads the given module inside the current resource, returning any values returned by the file or `true` when `nil`.
---@param modname string
---@return unknown?
---@return unknown
function lib.require(modname)
if type(modname) ~= 'string' then return end

View File

@@ -43,7 +43,8 @@ cache = {
}
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
error(err)
@@ -51,4 +52,4 @@ end
function lib.hasLoaded() return true end
lib.locale()
require = lib.require