Skip to content

Commit

Permalink
show script line number in hscript traces
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Jan 10, 2025
1 parent a9160ef commit 8e1d5be
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions source/modding/scripts/languages/HScript.hx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package modding.scripts.languages;

import haxe.PosInfos;
import states.PlayState;
import openfl.utils.Assets;
import sys.io.File;
Expand Down Expand Up @@ -173,9 +174,16 @@ class HScript extends Script {
trace(class_name + " isn't a valid class or enum!", WARNING);
});

set("trace", function(value:Dynamic) {
trace(value);
});

set("trace", Reflect.makeVarArgs(function(el) {
@:privateAccess
var inf = cast {fileName: path, lineNumber: interp.curExpr.line};
var v = el.shift();
if (el.length > 0)
inf.customParams = el;

haxe.Log.trace(Std.string(v), inf);
}));

set("load", function(path:String) {
var newScript:HScript = new HScript(path);
Expand Down

0 comments on commit 8e1d5be

Please sign in to comment.