Hscript addon with imports, usings, string interpolation and more.
package keyword (optional).
package scripts.hello.world;
import haxe.ds.StringMap;
var map = new StringMap();
map.set("Hello","World");
trace(map.get("Hello")); // World
you can use as
or in
keywords alias.
import haxe.ds.StringMap as StrMap;
var map = new StrMap();
map.set("Hello","World");
trace(map.get("Hello")); // World
import haxe.ds.StringMap in StrMap;
var map = new StrMap();
map.set("Hello","World");
trace(map.get("Hello")); // World
using Reflect;
var a = {
"Hello":"World"
};
trace(a.getProperty("Hello")); // World
RuleScript supports String Interpolation, but you can only use identifiers, double quotes string, calls without arguments and +
operator.
var a = 'Hello';
trace('RuleScript: $a World'); // RuleScript: Hello World
var a = {
a:'RuleScript',
b: () -> 'Hello',
c:'World'
};
trace('${a.a}: ${a.b() + " " + a.c}'); // RuleScript: Hello World
RuleScriptAbstracts.txt
in any classpath :
test.HelloWorldAbstract
test/HelloWorldAbstract.hx :
abstract HelloWorldAbstract(String) from String to String
{
public static function rulescriptPrint():HelloWorldAbstract
return 'Hello World';
}
Script :
import test.HelloWorldAbstract;
trace(HelloWorldAbstract.rulescriptPrint()); // 'Hello World'
More templates in test/src/Main.hx
.
- String interpolations don't support many functions
- Script
using
callback supports max number of arguments is 8. - Wildcard imports don't support.
- AbstractMacro ports only static fields
- Lua Parser
- Improve String Interpolation
- Improve hscript module parser
-
Installing lib:
Haxelib :
haxelib git rulescript https://github.com/Kriptel/RuleScript.git
Hmm :
hmm git rulescript https://github.com/Kriptel/RuleScript.git
-
Adding lib to your project:
Hxml :
-lib rulescript
Lime/OpenFL :
<haxelib name="rulescript"/>