From e840bbb50f50c46672af76f906b7fa57dd2b1c46 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Fri, 28 Oct 2022 18:29:16 +1100 Subject: [PATCH] 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. --- init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 4b820f4..95bafdb 100644 --- a/init.lua +++ b/init.lua @@ -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 ----------------------------------------------------------------------------------------------- @@ -46,8 +51,6 @@ end -- API ----------------------------------------------------------------------------------------------- -local export = exports[ox_lib] - local function call(self, index, ...) local module = rawget(self, index)