Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | J.B Stepan |
I have a .cfg like this:
[LoadedMods]
Mod="SomeMod"
Mod="AnotherMod"
I want to get the values of all the Mod
keys in the section, how do I do it?
While I’m not sure about the INI file implementation provided by Godot, most implementations will not allow a duplicate Key within the same section of the file.
So, for most INI readers, your example file isn’t even legal. Looking at the Godot docs on ConfigFile
, it looks like the basic method for retrieving a given value is get_value
which takes both a section name and a key name.
So, for your file, I’m not sure what you’d expect to get back if you requested the value for Section LoadedMods and Key Mod (since there are 2 Mod keys).
Bottom line, I’m not sure your file is even legal. And, even if it is, it seems like a less-than-ideal design.
jgodfrey | 2020-12-08 00:51