armory/Sources/armory/logicnode/ExpressionNode.hx

29 lines
496 B
Haxe
Raw Normal View History

2017-04-08 00:34:45 +02:00
package armory.logicnode;
2017-04-08 20:05:35 +02:00
class ExpressionNode extends LogicNode {
2017-04-08 00:34:45 +02:00
2019-12-19 23:54:08 +01:00
public var property0: String;
var result: Dynamic;
2017-04-08 00:34:45 +02:00
2019-12-19 23:54:08 +01:00
public function new(tree: LogicTree) {
2017-04-08 00:34:45 +02:00
super(tree);
}
2019-12-19 23:54:08 +01:00
override function run(from: Int) {
2017-04-08 00:34:45 +02:00
#if hscript
2017-04-08 00:34:45 +02:00
var expr = property0;
var parser = new hscript.Parser();
var ast = parser.parseString(expr);
var interp = new hscript.Interp();
result = interp.execute(ast);
2017-07-03 15:16:15 +02:00
#end
2017-04-08 00:34:45 +02:00
2018-10-22 10:10:33 +02:00
runOutput(0);
2017-04-08 00:34:45 +02:00
}
2019-12-19 23:54:08 +01:00
override function get(from: Int): Dynamic {
2017-04-08 00:34:45 +02:00
return result;
}
}