The only thing I want to do with the structure is check that "input_cmd" is
listed as a key in the structure.
I don't want to output any part of the structure.

In PHP I'd do it like this

if (empty($structure[$input_cmd]))

and in JavaScript I'd normally do it like this

if (structure[input_cmd] == null)

But I don't know how to handle the change from a structure to an
array/object

On 13 January 2011 13:40, George Toledo <gtole...@gmail.com> wrote:

> I totally haven't even read through your post, but note that you're
> declaring string input and output, while actually wanting to deal with
> structure. That's problematic, off top.
>
> What are you actually trying to achieve?
>
> -gt
>
> On Thu, Jan 13, 2011 at 8:37 AM, Charlie Francis <
> charl...@cellcastonline.com> wrote:
>
>> Hi,
>>
>> I'm struggling a bit with using JavaScript within Quartz, especially how
>> to use and abuse the structures that can be passed into the patch.
>> What I'm trying to achieve is only letting a string through that matches
>> one of the keys in the structure.
>> Also, if the composition has only just been run, and no strings have been
>> passed the return string should be blank.
>>
>> Below is an example of the structure I'm passing:
>>
>> 0: "left" = Structure
>>  0: "x" = -1
>> 1: "y" = 0
>> 1: "right" = Structure
>> 0: "x" = 1
>>  1: "y" = 0
>> 2: "center" = Structure
>>  0: "x" = 0
>>  1: "y" = 0
>>
>> And my Javascript at the moment is:
>>
>> function (__string output_cmd) main (__string input_cmd, __structure
>> positions)
>> {
>>  var result = new Object();
>> var firstRun;
>>
>> if(firstRun != 1) {
>>  input_cmd = '';
>> firstRun = 1;
>>  }
>>
>>  if (positions[input_cmd] == null) {
>> input_cmd = '';
>>  }
>>
>>  result.output_cmd = input_cmd;
>> return result;
>> }
>>
>> I seem to be getting an error on the if (positions[input_cmd] == null) {
>> line, saying that positions is not an object.
>>
>> I'm also pretty sure the firstRun section is correct, as I've tested it on
>> it's own and it works.
>>
>>
>> So what is the correct way to work with Structures inside of a JavaScript
>> patch?
>>
>> Regards,
>> Charlie
>>
>>  _______________________________________________
>> 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/gtoledo3%40gmail.com
>>
>> This email sent to gtole...@gmail.com
>>
>
>
>
> --
> George Toledo
> gtole...@gmail.com
> www.georgetoledo.com
>
> The information contained in this E-mail and any attachments may be
> confidential.
> If you have received this E-mail in error, please notify us immediately by
> telephone or return E-mail.
> You should not use or disclose the contents of this E-mail or any of the
> attachments for any purpose or to any persons.
>
>
 _______________________________________________
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

Reply via email to