Use Commas to Separate Arguments to Debug.write()

When you want to trace something to the Debugger in OpenLaszlo, you can call the Debug.write() method.

Often, you’ll want to write the value of something and a label, so that you can identify that output in the debugger, something like:

Debug.write("subviews: " + canvas.subviews);

However, it’s better to to get into a habit of use commas instead of a plus sign, like so:

Debug.write("subviews:", canvas.subviews);

Debug.write() takes an arbitrary number of arguments, which are comma-separated, and concatenates the output. If any of those arguments are complex objects (such as arrays, references to views, etc.) they’ll become links. If you click on them, you’ll be able to inspect the object itself. If you use the plus sign, then the JavaScript runtime will do the concatenation, and you’ll end up with a string; you won’t be able to click on the traced statement.

One thought on “Use Commas to Separate Arguments to Debug.write()

Leave a Reply

Your email address will not be published. Required fields are marked *