added better mod version comparison
This commit is contained in:
parent
ffe86bd684
commit
64cd6482d4
@ -1420,8 +1420,8 @@ function compareVersion(request)
|
||||
-- global variable to make it accessible for other functions
|
||||
modMeta = JSON.decode(request.text)
|
||||
|
||||
-- stop here if on latest version
|
||||
if MOD_VERSION == modMeta["latestVersion"] then return end
|
||||
-- stop here if on latest or newer version
|
||||
if convertVersionToNumber(MOD_VERSION) >= convertVersionToNumber(modMeta["latestVersion"]) then return end
|
||||
|
||||
-- stop here if "don't show again" was clicked for this version before
|
||||
if acknowledgedUpgradeVersions[modMeta["latestVersion"]] then return end
|
||||
@ -1432,6 +1432,13 @@ function compareVersion(request)
|
||||
Wait.time(function() UI.show("FinnIcon") end, 1)
|
||||
end
|
||||
|
||||
-- converts a version number to a string
|
||||
---@param version String Version number, separated by dots (e.g. 3.3.1)
|
||||
function convertVersionToNumber(version)
|
||||
local major, minor, patch = string.match(version, "(%d+)%.(%d+)%.(%d+)")
|
||||
return major * 100 + minor * 10 + patch
|
||||
end
|
||||
|
||||
-- updates the XML update notification based on the mod metadata
|
||||
function updateNotificationLoading()
|
||||
-- grab data
|
||||
|
Loading…
Reference in New Issue
Block a user