mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
fix(version): report unknown versions during checkDependency
Rather than throwing potentially fatal and confusing errors we should just report the current version as 'unknown'.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
function lib.checkDependency(resource, minimumVersion, printMessage)
|
function lib.checkDependency(resource, minimumVersion, printMessage)
|
||||||
local currentVersion = GetResourceMetadata(resource, 'version', 0):match('%d+%.%d+%.%d+')
|
local currentVersion = GetResourceMetadata(resource, 'version', 0)
|
||||||
|
currentVersion = currentVersion and currentVersion:match('%d+%.%d+%.%d+') or 'unknown'
|
||||||
|
|
||||||
if currentVersion ~= minimumVersion then
|
if currentVersion ~= minimumVersion then
|
||||||
local cv = { string.strsplit('.', currentVersion) }
|
local cv = { string.strsplit('.', currentVersion) }
|
||||||
@@ -10,7 +11,7 @@ function lib.checkDependency(resource, minimumVersion, printMessage)
|
|||||||
local current, minimum = tonumber(cv[i]), tonumber(mv[i])
|
local current, minimum = tonumber(cv[i]), tonumber(mv[i])
|
||||||
|
|
||||||
if current ~= minimum then
|
if current ~= minimum then
|
||||||
if current < minimum then
|
if not current or current < minimum then
|
||||||
if printMessage then
|
if printMessage then
|
||||||
return print(msg)
|
return print(msg)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user