Matter.ini 🌌 is a lightweight and simple library for parsing .ini data.
It offers an easy way to read, modify, and create your own .ini data.
- Comment Support: Ignores nodes starting with a semicolon(
;) or an hashtag (#). - Multi-line support: Allows you to define a node using triple quotation marks (
""" """,Multiline Test=\ possible\ hehe) - File Creation & Editing: Lets you create and edit .ini files
You can install the library directly using haxelib.
haxelib install miniOr you could install using git.
haxelib git mini https://github.com/hackx2/hxmini.gitParse & Access .ini data
Here is a simple example of how to use the parser in your Haxe project.
First, let's assume you have a file named config.ini with the following contents:
[main.test]
name="hackx2"
meows="meow"Now, you can parse this file and access its data:
import mini.Parser;
// Get `testing.ini`'s file content.
final content : String = sys.io.File.getContent('testing.ini');
// Parse the content.
final ini:Ini = Parser.parse(content);
// Get the element.
final main:Ini = ini.elementsNamed("main.test").next();
// Get and print data.
Sys.println(main.get('name')); // Returns "hackx2"
Sys.println(main.get('meows')); // Returns "meow"
// -----------------------------Create your own .ini files
Heres how you can create a .ini file:
// Create the document.
final ini:Ini = Ini.createDocument();
// Create a Section
final user:Ini = Ini.createSection("User");
user.set("username", "Milo");
user.set("role", "Admin");
user.set("progress", "78%");
ini.addChild(user);
user.get('progress'); // Returns: "78%"
ini.toString(); // Returns the serialized .ini documentContributions are always welcome and appreciated!!! 💖If you have a bug or have any suggestions, please open an issue.
This project is licensed under the MIT License.