diff --git a/resource/version/server.lua b/resource/version/server.lua index 6a96d1e64..e572e8157 100644 --- a/resource/version/server.lua +++ b/resource/version/server.lua @@ -19,12 +19,18 @@ function lib.versionCheck(repository) local latestVersion = response.tag_name:match('%d%.%d+%.%d+') if not latestVersion or latestVersion == currentVersion then return end - local cMajor, cMinor = string.strsplit('.', currentVersion, 2) - local lMajor, lMinor = string.strsplit('.', latestVersion, 2) - - if tonumber(cMajor) < tonumber(lMajor) or tonumber(cMinor) < tonumber(lMinor) then - return print(('^3An update is available for %s (current version: %s)\r\n%s^0'):format(resource, currentVersion, response.html_url)) - end + local cv = { string.strsplit('.', currentVersion) } + local lv = { string.strsplit('.', latestVersion) } + + for i = 1, #cv do + local current, minimum = tonumber(cv[i]), tonumber(lv[i]) + + if current ~= minimum then + if current < minimum then + return print(('^3An update is available for %s (current version: %s)\r\n%s^0'):format(resource, currentVersion, response.html_url)) + else break end + end + end end, 'GET') end) end diff --git a/resource/version/shared.lua b/resource/version/shared.lua index 3d14e457c..c8277207e 100644 --- a/resource/version/shared.lua +++ b/resource/version/shared.lua @@ -2,16 +2,22 @@ function lib.checkDependency(resource, minimumVersion, printMessage) local currentVersion = GetResourceMetadata(resource, 'version', 0):match('%d%.%d+%.%d+') if currentVersion ~= minimumVersion then - local cMajor, cMinor = string.strsplit('.', currentVersion, 2) - local mMajor, mMinor = string.strsplit('.', minimumVersion, 2) - + local cv = { string.strsplit('.', currentVersion) } + local mv = { string.strsplit('.', minimumVersion) } local msg = ("^1%s requires version '%s' of '%s' (current version: %s)^0"):format(GetInvokingResource() or GetCurrentResourceName(), minimumVersion, resource, currentVersion) - if tonumber(cMajor) < tonumber(mMajor) or tonumber(cMinor) < tonumber(mMinor) then - if printMessage then - return print(msg) - end - return false, msg + for i = 1, #cv do + local current, minimum = tonumber(cv[i]), tonumber(mv[i]) + + if current ~= minimum then + if current < minimum then + if printMessage then + return print(msg) + end + + return false, msg + else break end + end end end