ini.hx

Cross-platform ini parser and writer
https://github.com/Sword352/ini.hx

To install, run:

haxelib install ini.hx 1.0.0 

See using Haxelib in Haxelib documentation for more information.

README.md

Cross-platform .ini parser and writer for Haxe.

Installation

via haxelib

haxelib install ini.hx

or via git for latest updates

haxelib git ini.hx https://github.com/Sword352/ini.hx.git

Usage

  • Parsing ini content
package;

class Main {
    public static function main(): Void {
        var document: String = sys.io.File.getContent("myFile.ini");
        var object = ini.Ini.parse(document);

        trace(object); // {message: "Hello, world!", My Section: {sub_value: "Haxe is great!"}}
    }
}
; myFile.ini

message = Hello, world!

[My Section]
sub_value = Haxe is great!
  • Writing ini content
package;

import ini.Ast;

class Main {
    public static function main(): Void {
        var ast: Ast = ABlock([
            AKeyValuePair("isolated_key", CString("Value")),
            ASection("Section Name", [
                AKeyValuePair("boolean_value", CBool(true)),
                AKeyValuePair("number_value", CNumber(1))
            ])
        ]);

        /*
            isolated_key = Value
            [Section Name]
            boolean_value = true
            number_value = 1
        */
        trace(ini.Ini.write(ast));
    }
}

API

  • ini.Ini.parse converts ini string into object
  • ini.Ini.parseAst converts ini string into ini ast
  • ini.Ini.parseObject converts ini ast into object
  • ini.Ini.write converts ini ast into a readable ini document
Contributors
Sword352
Version
1.0.0
Published
1 year ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂