Page 1 of 1
Is there any way to save the data of the table permanently
Posted: Fri May 20, 2022 4:02 am
by sdgmlj
I mean, when I start a new game, I automatically read the data of the table
Re: Is there any way to save the data of the table permanently
Posted: Fri May 20, 2022 4:31 am
by FuryoftheStars
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?)
Re: Is there any way to save the data of the table permanently
Posted: Fri May 20, 2022 5:18 am
by sdgmlj
FuryoftheStars wrote: Fri May 20, 2022 4:31 am
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?)
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:
Code: Select all
global.my_mod = {}
global.my_mod.setting1 = true
global.my_mod.setting2 = true
..........
The values of these tables can be modified in the game. I want to automatically read the modified values when starting a new game, but now the result is that they can only be saved in each game. When starting a new game, they will be cleared. How can I save these tables?
Re: Is there any way to save the data of the table permanently
Posted: Fri May 20, 2022 5:23 am
by FuryoftheStars
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.
Re: Is there any way to save the data of the table permanently
Posted: Fri May 20, 2022 5:38 am
by sdgmlj
FuryoftheStars wrote: Fri May 20, 2022 5:23 am
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.
Can the value of "setting" be reversed? For example:
settings.global["my-mod-setting"].value = global.my_mod.setting1
In this way, I can add some hidden setting options to save these settings
Re: Is there any way to save the data of the table permanently
Posted: Fri May 20, 2022 1:21 pm
by FuryoftheStars
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.
Re: Is there any way to save the data of the table permanently
Posted: Sat May 21, 2022 4:34 am
by sdgmlj
FuryoftheStars wrote: Fri May 20, 2022 1:21 pm
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.
Thank you. I see