Skip to content

Commit

Permalink
fix(init): prevent loading multiple instances of ox_lib
Browse files Browse the repository at this point in the history
Resolves #545.
  • Loading branch information
thelindat committed Apr 11, 2024
1 parent e0e2bcf commit 3e66dcc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
---LGPL-3.0-or-later <https://www.gnu.org/licenses/lgpl-3.0.en.html>

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()
Expand All @@ -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
Expand Down

0 comments on commit 3e66dcc

Please sign in to comment.