How do you send an array to Javascript?
var a = arrayfromargs(messagename, arguments);
Quoting http://cycling74.s3.amazonaws.com/download/JavascriptInMax.pdf:
arrayfromargs(message, argument list): A utility for writing functions that take a variable number of arguments, and/or those that can be called using various messages (such as an anything function).
Hi -
As a beginner with Javascript in Max, this is the kind of question to which I also need answers, so "naturally" when I came across this forum post today, I copied the JSON text behind the patcher link and then (after a quick occular patdown of the JSON) "pasted new from clipboard" to see the patcher details in Max. I "saved as" the new patcher in a new folder and then downloaded the JS file into the same folder successfully while the new saved-as-patcher was still running. But when I tried to reload the patch (to "pick up" the "new" JS file), Max crashed. Max crashed again when I tried to reload the patcher by double clicking the saved-as filename. So I opened the JS file in my text editor only to find a (long, 10k) cryptic var assignment had (I assume) been tacked on at the bottom of the file (sometime in the last almost-three years?) . After commenting out that line and saving, Max was able to reload the patcher successfully. As a curious sort of person in this respect, I tried downloading that same JS file again to another directory for further analysis, twice, and both times (Windows default) Microsoft Security Essentials identified the file as "containing a virus" and deleted it without saving it.
Is this a common issue I can expect to deal with when downloading "JS files" from this forum?
For future visitors,
I would also like to add that the "full solution" to this question (and big thanks to HOLLYHOOK for the pointer and link) is that in order to pass an "array" from Max to Javascript you must pass the global (built-in) 'arguments' property to the arrayfromargs (built-in) function inside your custom array-processing Javascript function. You can't pass any of the declared function input parameters to 'arrayfromargs' because (I suspect) a function "input parameter" value is never a valid "arguments array" value.
Thanks!