A tool for modifying hardcoded values in your post-build Haxe application.
Change a value -> recompile -> test -> repeat. Every programmer has experienced this loop before; it's very tempting to "guess and check" when it comes to visually designing something with code. This library seeks to aliviate the tedious "recompile" step by allowing hardcoded values from your code to be modified AFTER compiling.
Table of Contents
| Topic | Description |
|---|---|
| Installation | How to install this library into your project. |
| .modhx Format | An explanation of the .modhx format. |
Installation
First install Modifaxe using one of the commands below:
# install haxelib release (may not exist atm!!)
haxelib install modifaxe
# install nightly (recommended!)
haxelib git modifaxe https://github.com/SomeRanDev/modifaxe.git
Next add the library to your .hxml or compile command:
-lib modifaxe
Add the @:modifaxe metadata to a class or function:
@:modifaxe
function getWindowSize() {
return 800;
}
Compile your Haxe project to a sys target with file-system access.
Modify the value(s) in the generated values.modhx file:
Main.getWindowSize:
i.return=800
.modhx Format
The .modhx is a text-based file format designed specifically for this project. It is designed to be both human-readable and easily parsable.
Comments
Content after a pound sign (#) is a comment and is ignored during parsing:
# This is a comment.
# This is also a comment.
Something # Comment after content
Sections and Values
Entries are separated into sections. A section is a unique identifier followed by a colon.
A list of values should follow with the \t<type>.<name>=<value> format:
[My.Unique.ID]
b.trueOrFalse=true
i.myNum=123
f.floatNum=6.9
s.string="Insert valid Haxe string here.
They can be multiline."
Please note the order of value entries MATTERS. The Haxe code for parsing the custom-made .modhx is hardcoded to expect the values in their generated order. The section and value identifiers exist to help humans locate values to modify.
Value Declaration Options
There are four types supported:
b is a boolean.
i is an integer.
f is a float.
s is a string.
The name must be a valid Haxe variable name.
The value must be a valid constant Haxe expression of the specified type.