added printArgs debug function
This commit is contained in:
		
							parent
							
								
									0c7280a2f5
								
							
						
					
					
						commit
						4b8bc87db9
					
				@ -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();
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user