Why settings stage, referring to settings-*.lua, tell about table 'data', and data stage, referring to data-*.lua tells about settings?https://lua-api.factorio.com/latest/Data-Lifecycle.html wrote:1. The settings stage
When Factorio first starts, [...] collect mod setting prototype data [...] into a global table named data. [...]
First the settings.lua file is called for each mod. Next, the settings-updates.lua [...] finally the settings-final-fixes.lua file is called for each mod. [...] The data table expects a specific format [...]
Changes made during each stage of the settings loading [...]. After the settings stage of loading has finished, [...] settings stage will not carry over to any other stages.
At the end of this stage all setting [...]
2. The data stage
Next, a new shared Lua state is created to process and collect all other prototype data [...] into a new global table named data. [...] a global table named 'settings' is populated with all startup type mod setting values during this stage.
First the data.lua file is called for each mod. Next, the data-updates.lua [...] and finally the data-final-fixes.lua [...]. The data table expects a specific format for each item in the table. [...]
Changes made during each stage of the data loading are [...]. After the data stage of loading has finished, [...]. Changes and functions defined during the data stage will not carry over to any other stages.
At the end of this stage, all prototypes are constructed and the game goes to the main menu.
[0.17.35][lua-api docs] Data Lifetime: 1.Settings-data 2.Data-settings
[0.17.35][lua-api docs] Data Lifetime: 1.Settings-data 2.Data-settings
Just reading lua-api and i am not sure about this:
Re: [0.17.35][lua-api docs] Data Lifetime: 1.Settings-data 2.Data-settings
The first sentence says "mod setting prototype data", which is correct, it's prototypes of mod settings, and it is indeed a table named "data" that those are put into. The doc is correct here.
The first sentence of section 2 correctly says that settings are available in a table named "settings". You use this table to read the settings.
The last sentence talks of prototypes. The data stage deals with prototypes. This, again, is correct.
The first sentence of section 2 correctly says that settings are available in a table named "settings". You use this table to read the settings.
The last sentence talks of prototypes. The data stage deals with prototypes. This, again, is correct.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Re: [0.17.35][lua-api docs] Data Lifetime: 1.Settings-data 2.Data-settings
Sorry for trouble, my bad.
I think confusion came from section 2 - "The global table named mods still exists and a global table named 'settings' is populated". Since "new shared Lua state", this means table "mods" and table "settings" are both injected into this new state before running any data-*.lua. I understood this as "this process [described in section 2] populates state table", then there are references to prototype data in settings section and i thought someone rushed with updating docs and updated wrong secion - this is why i posted this as "bug report"
-- edit:
or most likely from fact that there are "data" and "settings" stages, both that are using "settings" and "data" tables.
Not to continue (as i wont be using any of these).
I think confusion came from section 2 - "The global table named mods still exists and a global table named 'settings' is populated". Since "new shared Lua state", this means table "mods" and table "settings" are both injected into this new state before running any data-*.lua. I understood this as "this process [described in section 2] populates state table", then there are references to prototype data in settings section and i thought someone rushed with updating docs and updated wrong secion - this is why i posted this as "bug report"
-- edit:
or most likely from fact that there are "data" and "settings" stages, both that are using "settings" and "data" tables.
Not to continue (as i wont be using any of these).