[2.0.72] [Modding] Inconsistent environment setup during migrations when mod/control.lua is missing

Bugs that are actually features.
TBC_x
Inserter
Inserter
Posts: 30
Joined: Sun Sep 10, 2023 5:20 am
Contact:

[2.0.72] [Modding] Inconsistent environment setup during migrations when mod/control.lua is missing

Post by TBC_x »

Context
I had to come up with a way to migrate data in my primarily-scenario mod and it came to exfiltrating data through remote interface into the mod, which performs data migrations and then sends it back. Which is possible, thanks to some discipline (no metatables in storage) and hacks (handling invalid LuaObjects).

But after doing some clean up (It turned out I didn't need control.lua), all remote interfaces became unavailable in the migration script in the migrations directory.


What did you do?
I've removed control.lua from my mod

What happened?
remote.interfaces returns {} during migration

What did you expect to happen instead? It might be obvious to you, but do it anyway!
remote.interfaces should return all registered interfaces during migration

Does it happen always, once, or sometimes?
Always
Rseding91
Factorio Staff
Factorio Staff
Posts: 16276
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.72] [Modding] Inconsistent environment setup during migrations when mod/control.lua is missing

Post by Rseding91 »

Thanks for the report however this is working correctly. When a mod has a control.lua, the mods migration scripts run in that lua context. When the mod has no control.lua, the migration scripts run in a temporary lua context not owned by any specific mod.
If you want to get ahold of me I'm almost always on Discord.
User avatar
BraveCaperCat
Filter Inserter
Filter Inserter
Posts: 470
Joined: Mon Jan 15, 2024 10:10 pm
Contact:

Re: [2.0.72] [Modding] Inconsistent environment setup during migrations when mod/control.lua is missing

Post by BraveCaperCat »

Rseding91 wrote: Tue Nov 04, 2025 12:14 pm Thanks for the report however this is working correctly. When a mod has a control.lua, the mods migration scripts run in that lua context. When the mod has no control.lua, the migration scripts run in a temporary lua context not owned by any specific mod.
Ok, but that has any bearing on this issue... how?
The issue was not about lua contexts, it was about remote.interfaces being completely empty in migration scripts when the control.lua file is missing, but (potentially) not empty in migration scripts when the control.lua file is not missing.
Creator of multiple mods, including Quality Assurance - My most popular one.
Go check them out with the first and second links!
I'll probably be wanting or giving help with modding most of the time I spend here on the forum.
Post Reply

Return to “Not a bug”