From 4d6e8db5ff307357a161421dbbd02b76b14b7096 Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Thu, 30 Mar 2023 17:34:50 +0200 Subject: [PATCH 1/2] helpers --- hscript/IHScriptCustomConstructor.hx | 5 +++++ hscript/Interp.hx | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 hscript/IHScriptCustomConstructor.hx diff --git a/hscript/IHScriptCustomConstructor.hx b/hscript/IHScriptCustomConstructor.hx new file mode 100644 index 0000000..7780feb --- /dev/null +++ b/hscript/IHScriptCustomConstructor.hx @@ -0,0 +1,5 @@ +package hscript; + +interface IHScriptCustomConstructor { + public function hnew(...args:Array):Dynamic; +} \ No newline at end of file diff --git a/hscript/Interp.hx b/hscript/Interp.hx index 4a5d669..fddc481 100644 --- a/hscript/Interp.hx +++ b/hscript/Interp.hx @@ -50,6 +50,7 @@ class Interp { return scriptObject = v; } public var errorHandler:Error->Void; + public var importFailedCallback:Array->Bool; #if haxe3 public var variables:Map; public var publicVariables:Map; @@ -460,8 +461,8 @@ class Interp { var en = Type.resolveEnum(realClassName); if (cl == null && en == null) { - // LogsOverlay.trace('Class / Enum at $realClassName does not exist.'); - error(EInvalidClass(realClassName)); + if (importFailedCallback == null || !importFailedCallback(splitClassName)) + error(EInvalidClass(realClassName)); } else { if (en != null) { // ENUM!!!! From fc50ebdf90a2ecee966a03d88f38514c01057494 Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Fri, 31 Mar 2023 00:12:54 +0200 Subject: [PATCH 2/2] Small Fix --- hscript/IHScriptCustomConstructor.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hscript/IHScriptCustomConstructor.hx b/hscript/IHScriptCustomConstructor.hx index 7780feb..c67719c 100644 --- a/hscript/IHScriptCustomConstructor.hx +++ b/hscript/IHScriptCustomConstructor.hx @@ -1,5 +1,5 @@ package hscript; interface IHScriptCustomConstructor { - public function hnew(...args:Array):Dynamic; + public function hnew(args:Array):Dynamic; } \ No newline at end of file