A member on a forum I frequent asked about accessing multidimensional arrays using dot notation. The exact format he was looking for as akin to:
At least one member provided a working example, but it was sloppy. Used globals and did no error checking. His example, while technically valid, was prone to erring out due to undefined indices.
The Class: Dot Notation Configuration
You’ll notice you can push arrays as deep as you wish. It doesn’t matter how you have your configuration nested, the script will be able to handle it.
Also, if you supply a file to the constructor (upon instantiation), then the file will be automatically updated upon destruction. But you also have the ability to load a configuration file, or save one, at will.
Let me know in a comment below if this class has been of any help to you. I’d love to find out what you’re using it for. Or if you run into any problems, let me know and I’ll get them sorted out.
This script can be found on my GitHub.