Migration, possible mistake on version number comparison...

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
binbinhfr
Smart Inserter
Smart Inserter
Posts: 1524
Joined: Sat Feb 27, 2016 7:37 pm
Contact:

Migration, possible mistake on version number comparison...

Post by binbinhfr »

Hi,

I just noticed a migration error that I made, and other too, and I wonder if factorio is not doing the same (I suppose not).

But I wanted to inform, in case...

Infact in config_changed event, I was doing things like :
if changes.old_version and changes.old_version < "1.0.12" then (...)

But if old_version = 1.0.8, it does not work, because of the way the strings are compared... It tooks me time to understand this simple mistake... :D
And I noticed that other (well known) mods are doing the same mistake.

But I wonder if factorio internal are not doing the same mistake ? There are several places :
For migration script numbering ? *.json, *.lua
For json dependencies ? like ["? reactor>= 0.13.25"]
I suppose no, because mod list seems to be accurate, but I'll let the devs check because I am lazy to make further testings today. :-)

By the way, is there a simple trick to compare these chains ? (I will write a function using regex...)
Or maybe there is a hidden CompareModVersion function that the devs could make public in util.lua ?
My mods on the Factorio Mod Portal :geek:

Post Reply

Return to “Modding discussion”