diff --git a/src/lib/Debug.hx b/src/lib/Debug.hx index c4d558d..be28d6a 100644 --- a/src/lib/Debug.hx +++ b/src/lib/Debug.hx @@ -1,5 +1,6 @@ package lib; +import lua.TableTools; import kernel.KernelEvents; import kernel.log.Log; import lua.NativeStringTools; @@ -37,6 +38,27 @@ class Debug { Log.debug("\n" + lines.join("\n")); } + public static function printArgs(?pos:haxe.PosInfos) { + var info = lua.Debug.getinfo(2); + + var args = ""; + + for (i in 1...info.nparams + 1) { + var t = TableTools.pack(lua.Debug.getlocal(2, i)); + if (t[1] == "self") { + continue; + } + + if (args != "") { + args += ", "; + } + + args += t[1] + ":" + t[2]; + } + + Log.debug('${pos.className}.${pos.methodName}($args)'); + } + #if Debug public static function printKernelEventsCount() { KernelEvents.printListenerCount();