Skip to content

Commit

Permalink
refactor(init): report ox_lib error when loading imports
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
thelindat committed Oct 28, 2022
1 parent 97c18f0 commit e840bbb
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ if not _VERSION:find('5.4') then
end

local ox_lib = 'ox_lib'
local export = exports[ox_lib]

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

local status = export.hasLoaded()

if status ~= true then error(status, 2) end

-----------------------------------------------------------------------------------------------
-- Module
-----------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -46,8 +51,6 @@ end
-- API
-----------------------------------------------------------------------------------------------

local export = exports[ox_lib]

local function call(self, index, ...)
local module = rawget(self, index)

Expand Down

0 comments on commit e840bbb

Please sign in to comment.