[16.36] Opening file __ModNameHere__/control.lua failed

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

[16.36] Opening file __ModNameHere__/control.lua failed

Post by Fractaliste » Wed May 16, 2018 7:48 am

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 170 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: 7978
Joined: Wed Jun 11, 2014 5:23 am

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

Post by Rseding91 » Wed May 16, 2018 8:54 am

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 IRC and Discord.

Fractaliste
Burner Inserter
Burner Inserter
Posts: 16
Joined: Wed Dec 06, 2017 9:20 am

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

Post by Fractaliste » Wed May 16, 2018 9:00 am

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: 7978
Joined: Wed Jun 11, 2014 5:23 am

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

Post by Rseding91 » Wed May 16, 2018 9:34 am

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 IRC and Discord.

Post Reply

Return to “Won't fix.”