Page 1 of 1

Migration, possible mistake on version number comparison...

Posted: Tue Jul 19, 2016 7:27 am
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 ?