Last active
August 29, 2015 13:57
-
-
Save Simn/9640418 to your computer and use it in GitHub Desktop.
hxtemplo config parsing example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-cp src | |
-main Main | |
-lib hxtemplo | |
--interp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Main { | |
public static function main () { | |
var cfgString = "{ | |
'someValue': ::(values.width-305)/2 + values.height::, | |
'constantValue': 13 | |
}"; | |
var template = new templo.Template(new haxe.io.StringInput(cfgString)); | |
var values = { | |
width: 500, | |
height: 1 | |
}; | |
trace(template.execute({values: values})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment