Electric Trains


Adds electric trains.

Content
a month ago
0.16 - 1.1
37.1K
Trains

b Error loading save after upgrading from original Electric Trains

1 year, 10 months ago

I just downloaded this to replace the old Electric Trains mod.
On loading an existing save, I got this:

The mod Electric Train Patched (1.1.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event ElectricTrainPatched::on_configuration_changed
ElectricTrainPatched/lib.lua:20: bad argument #1 of 3 to 'match' (string expected, got nil)
stack traceback:
[C]: in function 'match'
ElectricTrainPatched/lib.lua:20: in function <ElectricTrainPatched/lib.lua:19>
(...tail calls...)
ElectricTrainPatched/control.lua:53: in function <ElectricTrainPatched/control.lua:47>

1 year, 10 months ago

The problem appears to be that this is the table that exists in the 'data' variable sent to on_configuration_changed:

{
mod_changes= {
ElectricTrainPatched= {
new_version= "1.1.3",
},
ElectricTrain= {
old_version= "1.1.2",
},
},
mod_startup_settings_changed= "false",
migration_applied= "false",
}

So, when GetNewVersion is called, with the old "ElectricTrain" name, the value is nil.

This code is unchanged from version 1.1.2 of ElectricTrain, but this points out a bug for the corner case of upgrading from ElectricTrain to ElectricTrainPatched.

I implemented a fix by simply passing the string "ElectricTrainPatched" to the call to GetNewVersion, instead of passing the modName local variable to it, which isn't used anywhere else, anyway.

1 year, 10 months ago

Oops. Wrong mod. πŸ€¦β€β™‚οΈ

New response