Re: A reference to problem
Re: A reference to problem
- Subject: Re: A reference to problem
- From: Paul Skinner <email@hidden>
- Date: Mon, 04 Jun 2001 15:33:59 -0400
on 6/3/01 7:47 AM, Serge Belleudy-d'Espinose wrote:
>
Hi all,
>
>
As seen in the ASLG, I would like to take the benefit of one such construct:
>
>
> repeat with i from 1 to 1000
>
> set xList's end to i
>
> end repeat
>
>
>
> set rxList to a reference to xList
>
>
>
> repeat with i from 1 to 1000
>
> rxList's item i
>
> end repeat
>
>
Oh oh, this is fa-a-a-st :)
>
>
But once inside a handler, the line 'rxList's item i' gets me
>
>
-- Can't get item 1 of xList.
>
>
???
>
>
Ok, I understand this is a kind of scope problem.
>
I can use 'global xList' anywhere inside or outside the handler, but this is
>
obviously not what I want.
>
None of the my/of me/'s I tried did work.
>
rxList is 'xList of <<script>>', but I cannot get the class of it. Who is
>
script?
>
>
I'm stumped.
Did you try supplying the list reference directly to the handler in it's
parameters?
set theList to {"the ", "values ", "you ", "want"}
-->{"the ", "values ", "you ", "want "}
set listRef to a reference to theList
-->theList of +script;
doStuffWithList(listRef)
-->"the values you want."
on doStuffWithList(aList)
return (every item of aList as string) & "."
end doStuffWithList
--
Paul Skinner