Page 1 of 1

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

Posted: Tue Nov 04, 2025 8:21 am
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

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

Posted: Tue Nov 04, 2025 12:14 pm
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.

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

Posted: Tue Nov 04, 2025 2:47 pm
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.