Are mods in Factorio isolated from one another? If so how? To what degree?
I see a lot of mods that interact with one another. I'm curious as to how that is done. From what I can tell poking about they check remote.interfaces for the mod then do a remove.call.
Is this the only way mods can see each other? Am I wasting time and effort with my mod making sure everything is prepended with my mod's name to avoid naming conflicts? What about when using the global variable? Is the global variable shared between all mods or is it "unique" to each mod? Such as if one mod does global.a =1 and my mod does global.a=3 later do both mods see global.a as 3 when they check on it in the future or what they each set it too?
If all of this is covered in the wiki please provide me a link to the page with this info. I certainly wasn't locating it. Thanks!
Question about mod encapsulation.
Re: Question about mod encapsulation.
Yes, each mod runs in its own lua instance so everything at the control.lua level is unique and isolated for your mod.credomane wrote:Am I wasting time and effort with my mod making sure everything is prepended with my mod's name to avoid naming conflicts?
The only shared state is the data.lua loading phase and that happens one by one for mods.
If you want to get ahold of me I'm almost always on Discord.
Re: Question about mod encapsulation.
Thanks Rseding91! I knew during initial mod loading the data was shared between all mods but I didn't know about anything else. Suppose if I thought about it I could have just made two dummy mods that hated each other and the results of that would have given me my answer.
Another question if you don't mind. When you save your game in Factorio what parts of the mod get saved in the world save? Only the things in global, everything or just depends?
Another question if you don't mind. When you save your game in Factorio what parts of the mod get saved in the world save? Only the things in global, everything or just depends?
Re: Question about mod encapsulation.
The only Lua data that's saved is the "global" table for each mod.credomane wrote:Thanks Rseding91! I knew during initial mod loading the data was shared between all mods but I didn't know about anything else. Suppose if I thought about it I could have just made two dummy mods that hated each other and the results of that would have given me my answer.
Another question if you don't mind. When you save your game in Factorio what parts of the mod get saved in the world save? Only the things in global, everything or just depends?
If you want to get ahold of me I'm almost always on Discord.
Re: Question about mod encapsulation.
Thanks again! Now back to working on my mod. 
