philly stage

This commit is contained in:
Yoshman29
2022-10-07 18:44:57 +02:00
parent 1e156c83ee
commit 666c7fa7e0
10 changed files with 247 additions and 32 deletions
+6 -2
View File
@@ -6,6 +6,8 @@ import hscript.*;
class HScript extends Script {
var interp:Interp;
var expr:Expr;
public override function onCreate(path:String) {
super.onCreate(path);
@@ -14,14 +16,12 @@ class HScript extends Script {
var code:String = Assets.getText(path);
var parser = new hscript.Parser();
parser.allowJSON = parser.allowMetadata = parser.allowTypes = true;
var expr:Expr;
try {
expr = parser.parseString(code, fileName);
} catch(e) {
return;
}
interp.errorHandler = _errorHandler;
interp.execute(expr);
}
private function _errorHandler(error:Error) {
@@ -32,6 +32,10 @@ class HScript extends Script {
interp.scriptObject = parent;
}
public override function onLoad() {
interp.execute(expr);
}
private override function onCall(funcName:String, parameters:Array<Dynamic>):Dynamic {
if (interp == null) return null;