From 3e66dccb4bf71bb427cfd97bbdb03b799ffe3525 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Thu, 11 Apr 2024 15:03:41 +1000 Subject: [PATCH] fix(init): prevent loading multiple instances of ox_lib Resolves #545. --- init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index 6b795c80..9e6d07a1 100644 --- a/init.lua +++ b/init.lua @@ -4,7 +4,7 @@ ---LGPL-3.0-or-later if not _VERSION:find('5.4') then - error('^1Lua 5.4 must be enabled in the resource manifest!^0', 2) + error('Lua 5.4 must be enabled in the resource manifest!', 2) end local resourceName = GetCurrentResourceName() @@ -13,6 +13,10 @@ local ox_lib = 'ox_lib' -- Some people have decided to load this file as part of ox_lib's fxmanifest? if resourceName == ox_lib then return end +if lib and lib.name == ox_lib then + error(("Cannot load ox_lib more than once.\n\tRemove any duplicate entries from '@%s/fxmanifest.lua'"):format(resourceName)) +end + local export = exports[ox_lib] if GetResourceState(ox_lib) ~= 'started' then