> Also new question: > >> > <More brain drain!.qtz> I don't understand the question.
>> Log(i+": _in:"+typeof(_in)); will tell you it's an "object" (which can't >> generally be logged). >> Log(i+": _in:"+_in[0]); will print the first value of each substructure >> (which happens to be a number, which is OK for logging). > Okay the meat and potatoes. In the long code I pulled this from I'm not > logging, I am assigning. In that case, you're assigning inputs, which won't work. > I am used to logging objects successfully, but I guess Input objects > (declared in the main function) are a no go? [yes/no] Input structures are "special" enough to make JS throw the TypeError exception when you try to print it. They're special because they're not actual JS objects, but QC objects with a JS wrapper (perhaps the wrapper's not complete enough to allow that to work as expected? I don't know). Anyway, to log any kind of object, use the following (paste at the top of your JS): > function logObj_(obj, depth) // private function, don't call directly > { > var head = ""; > for(var i = 0; i < depth; ++i) > head = head.concat(" "); > for (i in obj) { > if(typeof(obj[i]) == "object") { > Log(head+"key: " + i + " object:"); > logObj_(obj[i], depth+1); > } > else > Log(head+"key: "+ i +" value: " + obj[i]); > } > } > > function logObj(obj) // call this one > { > if(obj) > { > Log("Object:"); > return logObj_(obj, 0); > } > } then just call logObj(<your object here>) and it'll grind through it whether or not it's a QC-originated object. > Did you get that comp I sent you directly a couple of weeks ago with a > "Please Explain?!" It had two JS patches, essentially the same code > (different variable names) one patch worked (the fresh one), one patch didn't > ( the one where I had deleted bad code to leave just four lines of code). > He it is again (new filename): >> > <JS patch gone south for winter.qtz> [in the future, please don't have compositions depend on 3rd party plugins -- I opened it previously, saw the warning, and gave up; turns out its irrelevant in this case though]. "Essentially the same", except that one is syntactically wrong: you cannot have a variable name start with a number. 2D_Array is not a valid identifier. TwoD_Array is. Array2D is. A123456789 is. 123456789A is not. The reason for this is because it makes parsing impossible otherwise: 2e3 could be a number in scientific notation, or it could be a variable. No way to tell which it is. Thus, the first letter of a variable (or function) must not be a number. -- Christopher Wright christopher_wri...@apple.com
_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com