diff --git a/source/Main.hx b/source/Main.hx index 77c940a8..7f7f569b 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -171,12 +171,6 @@ class Main extends Sprite FlxG.scaleMode = new MobileScaleMode(); #end - #if HSCRIPT_ALLOWED - crowplexus.iris.Iris.logLevel = function(level: crowplexus.iris.ErrorSeverity, x, ?pos: haxe.PosInfos): Void { - if (PlayState.instance != null) PlayState.instance.addTextToDebug("ERROR: "+Std.string(x), FlxColor.RED); - } - #end - // shader coords fix FlxG.signals.gameResized.add(function (w, h) { if(fpsVar != null) diff --git a/source/psychlua/HScript.hx b/source/psychlua/HScript.hx index c387230b..a9bded42 100644 --- a/source/psychlua/HScript.hx +++ b/source/psychlua/HScript.hx @@ -472,11 +472,20 @@ class HScript extends Iris } #end - public function executeScript(code:String, ?varsToBring:Any = null):Dynamic { + public function executeScript(code:String, ?varsToBring:Any = null):Dynamic + { this.varsToBring = varsToBring; scriptCode = code; parse(true); - return returnValue = execute(); + try + { + returnValue = execute(); + } + catch(e) + { + PlayState.instance.addTextToDebug('ERROR (${this.origin}:${this.interp.posInfos()}): ${e}', FlxColor.RED); + } + return returnValue; } /*override function irisPrint(v):Void