Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JavaScript Structure Handling




The problem is something like this: When it JS patch first starts, structure inputs aren't valid (they're NULL), so you can't ask for indexes etc. The version above first checks to make sure show_data is valid, and then indexes it only when valid -- this gets around the null value problem you ran into before.

As Christopher pointed out, the JS patch is executed once with all input ports set tu NULL before it is actually used. Another way to get around this yielding errors for structs is to simply check for the global _testMode variable:


// Returns the number of elements inside a struct
function (__index count) main (__structure struct)
{
	var result = new Object();
	
	if (_testMode)
		result.count = 0;
	else
		result.count = struct.length();

	return result;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/email@hidden

This email sent to email@hidden
References: 
 >JavaScript Structure Handling (From: Steven Sokulski <email@hidden>)
 >Re: JavaScript Structure Handling (From: Christopher Wright <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.