HISE Docs

Console


The Console object allows you to print any value to the console of HISE .

Console.print("Hello World " + 3.4); // Prints "Hello World + 3.4 to the console.

Console.assertEqual(x, y); // You could write assertion tests to check your code. 

Console.start(); // You can benchmark your scripts Compile-time with:
Console.stop(); // wrapping these two Console commands around your code.

There are reserved characters to alter the text's colour in a line. (Note that a colon character ends the formatting.)


Class methods

assertEqual

Throws an error message if the values are not equal. Edit on GitHub

Console.assertEqual(var v1, var v2)



assertIsDefined

Throws an error message if the value is undefined. Edit on GitHub

Console.assertIsDefined(var value)



assertIsObjectOrArray

Throws an error message if the value is not an object or array. Edit on GitHub

Console.assertIsObjectOrArray(var value)



assertLegalNumber

Throws an error message if the value is not a legal number (eg. string or array or infinity or NaN). Edit on GitHub

Console.assertLegalNumber(var value)



assertNoString

Throws an error message if the value is a string. Edit on GitHub

Console.assertNoString(var value)



assertTrue

Throws an error message if the condition is not true. Edit on GitHub

Console.assertTrue(var condition)



Sends a blink message to the current editor. Edit on GitHub

Console.blink()



breakInDebugger

Throws an assertion in the attached debugger. Edit on GitHub

Console.breakInDebugger()



clear

Clears the console. Edit on GitHub

Console.clear()



print

Prints a message to the console. Edit on GitHub

Console.print(var debug)



sample

Stores the current state of the given data into the current sampling session.

Console.sample( String label, var dataToSample)


This samples the given data point and stores it with the provided label. In order to use this, a sampling session must be active, which can be achieved with either Console or the .sample() scoped statement.

Once you've started a sampling session, you can call this method and it will create a copy of the provided data and lets you inspect the data by clicking on the item in the code editor next to this line.

{
	.sample("my session"); // starts a sampling session until the block is done
	
	var x = [1, 2, 3, 4, 5];
	
	// creates a snapshot of the array and stores it as the first label
	Console.sample("first", x);
	
	x[2] = 0;
	
	// creates a snapshot of the array and stores it under the second label
	Console.sample("second", x);
}

Note how th

startBenchmark

Starts the benchmark. You can give it a name that will be displayed with the result if desired. Edit on GitHub

Console.startBenchmark()



startSampling

Starts a sampling session with the given ID. Edit on GitHub

Console.startSampling( String sessionId)



stop

Causes the execution to stop(). Edit on GitHub

Console.stop(bool condition)



stopBenchmark

Stops the benchmark and prints the result. Edit on GitHub

Console.stopBenchmark()