Is there any way to save the data of the table permanently
Is there any way to save the data of the table permanently
I mean, when I start a new game, I automatically read the data of the table
-
- Smart Inserter
- Posts: 2540
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Is there any way to save the data of the table permanently
What table?
There is the "global" table available to each mod that is saved and load from the save file. You can store things you need need to persist there. There are some limitations, though. There was a discussion about it not too long ago: viewtopic.php?f=25&t=102241
(But seriously, what table?)
There is the "global" table available to each mod that is saved and load from the save file. You can store things you need need to persist there. There are some limitations, though. There was a discussion about it not too long ago: viewtopic.php?f=25&t=102241
(But seriously, what table?)
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles
Re: Is there any way to save the data of the table permanently
I can't understand those discussions. The table I'm talking about is the custom global table of my mod, which is used to save some setting data of my GUI, for example:FuryoftheStars wrote: ↑Fri May 20, 2022 4:31 amWhat table?
There is the "global" table available to each mod that is saved and load from the save file. You can store things you need need to persist there. There are some limitations, though. There was a discussion about it not too long ago: viewtopic.php?f=25&t=102241
(But seriously, what table?)
Code: Select all
global.my_mod = {}
global.my_mod.setting1 = true
global.my_mod.setting2 = true
..........
-
- Smart Inserter
- Posts: 2540
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Is there any way to save the data of the table permanently
The global table cannot be used between different save files.
Any “settings” of that nature that you need to persist between different games, you’ll need to use actual settings for (https://wiki.factorio.com/Tutorial:Mod_settings). Note that the user will need to set these from the main menu in order for changes to persist. Changing from within a running game will affect that game only.
Any “settings” of that nature that you need to persist between different games, you’ll need to use actual settings for (https://wiki.factorio.com/Tutorial:Mod_settings). Note that the user will need to set these from the main menu in order for changes to persist. Changing from within a running game will affect that game only.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles
Re: Is there any way to save the data of the table permanently
Can the value of "setting" be reversed? For example:FuryoftheStars wrote: ↑Fri May 20, 2022 5:23 amThe global table cannot be used between different save files.
Any “settings” of that nature that you need to persist between different games, you’ll need to use actual settings for (https://wiki.factorio.com/Tutorial:Mod_settings). Note that the user will need to set these from the main menu in order for changes to persist. Changing from within a running game will affect that game only.
settings.global["my-mod-setting"].value = global.my_mod.setting1
In this way, I can add some hidden setting options to save these settings
-
- Smart Inserter
- Posts: 2540
- Joined: Tue Apr 25, 2017 2:01 pm
- Contact:
Re: Is there any way to save the data of the table permanently
Yes, but similar to a player trying to change the setting during a running game, (as far as I know) it will not persist between different games/saves.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles
Re: Is there any way to save the data of the table permanently
Thank you. I seeFuryoftheStars wrote: ↑Fri May 20, 2022 1:21 pmYes, but similar to a player trying to change the setting during a running game, (as far as I know) it will not persist between different games/saves.