Forums > Javascript

debug function javascript

Feb 15 2010 | 3:42 am

sorry if this is obvious, i searched dcs and forums but couldn’t find an answer.
i have a basic patcher below, basically turns on/off a debug variable in the js script. if the function is called setdebug, it works ok, but if the function is called debug, it doesn’t work at all. indeed, when i call a function named debug from another one (not i the script below) it says "debug is not defined". i’m not a javascript expert but my search of the web didn’t indicate debug() was a reserved function or keyword.
can anyone help? cheers,,

//the patch

-- Pasted Max Patch, click to expand. --

//the javascript (debugtest.js)

//inlets and outlets
inlets = 2;
outlets = 1;

var dbg=1;

//if renamed to debug() it stops working

function setdebug(a)
if(a) {
post("debug on n")
} else {
post("debug off n")

Feb 16 2010 | 3:20 am

so today i can call debug from another function without error. but i couldn’t see the debug message in the js or jsui list of messages (as per the "reserved words" paragraph from: the only debug message reference i could find was from messages to dsp/max, but renaming the function to other max/dsp functions works (i.e. set/reset the debug flag in the js). i just don’t know what behavior I’m seeing here.

Feb 20 2010 | 1:06 am

so does this work for everyone? no-one cares? or have i discovered an "undocumented feature"?
it’s not a big deal, but not knowing is bugging me,,

Feb 20 2010 | 1:11 am

I get the same behaviour as you mentioned in your first post. Sending any "debug" message to the javascript causes no response from a debug() or anything() function. Possibly something undocumented to do with the built in max debugger?


Feb 20 2010 | 1:16 am

i see. cheers,,

Viewing 5 posts - 1 through 5 (of 5 total)

Forums > Javascript