[16.36] Opening file __ModNameHere__/control.lua failed

Things that we don't consider worth fixing at this moment.
Post Reply
Fractaliste
Inserter
Inserter
Posts: 28
Joined: Wed Dec 06, 2017 9:20 am
Contact:

[16.36] Opening file __ModNameHere__/control.lua failed

Post by Fractaliste »

What did you do?
I'm making a mod which currently just write something into factorio's log file. My mode is already activated, so I run the game and load any save with some automated trains (I attach the one I use for the screenshot).
In background I look factorio's logs and I se my strings ("Hello world") into the logs. Still in background I edit with Notepadd++ the control.lua file to comment the 4th line (the hello world one's) and update it into the zip archive which contains my mod (the path "C:\Users\MyHome\AppData\Roaming\Factorio\mods\RaphikiTrain_0.16.0.zip"), the game is still running well.

I reload the savegame and I got the following error :
80.493 Error AppManagerStates.cpp:1304: Opening file __RaphikiTrain__/control.lua failed -- error code -102
I close the game, re-run it, re-open the same savegame and I got no error. Into news logs I see that my "Hello world" is well comment, so it should be not a syntax error...
What happened?
modLoad.png
modLoad.png (886.94 KiB) Viewed 1617 times
What did you expect to happen instead? It might be obvious to you, but do it anyway!
I expect my control.lua file to be reopened since Factorio API's documentation tells that (see from http://lua-api.factorio.com/latest/Data-Lifecycle.html) :
4. control.lua initialization

During this stage each mod's control.lua is loaded and executed in their own Lua instance that will be owned by that mod for the remainder of the play session. Each mod has its own Lua instance and own global table to store data. Because this is run every time a save file is created or loaded you don't need to restart the game to see changes made to the control.lua file. Simply restarting or reloading a save will re-run this stage.

During this stage access to the global table is not available. The script table and the remote table are however available. Note, although the global table has not been setup if a mod does populate the table with some data it will be overwritten by any loaded data.

At the end of this stage (if loading a save file) mod data saved in the map file is loaded and the global table for each mod is restored.
Attachments

Rseding91
Factorio Staff
Factorio Staff
Posts: 13201
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [16.36] Opening file __ModNameHere__/control.lua failed

Post by Rseding91 »

Thanks for the report however editing the zip file while the game is running isn't supported.

If you want to live-edit the control.lua file you need to extract the mod into a folder first and use that.
If you want to get ahold of me I'm almost always on Discord.

Fractaliste
Inserter
Inserter
Posts: 28
Joined: Wed Dec 06, 2017 9:20 am
Contact:

Re: [16.36] Opening file __ModNameHere__/control.lua failed

Post by Fractaliste »

Ok so what is the "mods" directory's structure I should use? If I unzip my files into the mods directory it is not detected anymore :/

Rseding91
Factorio Staff
Factorio Staff
Posts: 13201
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [16.36] Opening file __ModNameHere__/control.lua failed

Post by Rseding91 »

Fractaliste wrote:Ok so what is the "mods" directory's structure I should use? If I unzip my files into the mods directory it is not detected anymore :/
The same as any zip:

mods\your_mod_name_1.0.0\control.lua
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Won't fix.”