mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
refactor(init): report ox_lib error when loading imports
People like to cry about resources not working because they failed to install ox_lib and don't know how to read, missing the fat error and stack trace on resource start. Now we can remind these people they need to actually install a release.
This commit is contained in:
9
init.lua
9
init.lua
@@ -7,11 +7,16 @@ if not _VERSION:find('5.4') then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local ox_lib = 'ox_lib'
|
local ox_lib = 'ox_lib'
|
||||||
|
local export = exports[ox_lib]
|
||||||
|
|
||||||
if not GetResourceState(ox_lib):find('start') then
|
if not GetResourceState(ox_lib):find('start') then
|
||||||
error('^1ox_lib should be started before this resource^0', 2)
|
error('^1ox_lib should be started before this resource.^0', 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local status = export.hasLoaded()
|
||||||
|
|
||||||
|
if status ~= true then error(status, 2) end
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
-- Module
|
-- Module
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
@@ -46,8 +51,6 @@ end
|
|||||||
-- API
|
-- API
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
local export = exports[ox_lib]
|
|
||||||
|
|
||||||
local function call(self, index, ...)
|
local function call(self, index, ...)
|
||||||
local module = rawget(self, index)
|
local module = rawget(self, index)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user