Re: Applescript-users Digest, Vol 2, Issue 492
Re: Applescript-users Digest, Vol 2, Issue 492
- Subject: Re: Applescript-users Digest, Vol 2, Issue 492
- From: Michelle Steiner <email@hidden>
- Date: Wed, 27 Jul 2005 21:44:18 -0700
On Jul 27, 2005, at 7:44 PM, Ryan Wilcox wrote:
(*<code language="Applescript">*)
set sk1 to 1
set sk2 to 2
set listItem1 to {sk1}
set listItem2 to {sk2}
set myList to {listItem1, listItem2}
set mycopy to items of myList
set item 1 of mycopy to {42}
log myList
log mycopy
log listItem1
(*</code>*)
I get {1, 2}, {{42}, {2}}, and {1}, respectively. So obviously I'm not
copying a reference to sk1 with my shallow copy.
You didn't copy a list to another list; you copied items of a list to
another list.
Try this:
set sk1 to 1
set sk2 to 2
set listItem1 to {sk1}
set listItem2 to {sk2}
set myList to {listItem1, listItem2}
set mycopy to myList
set item 1 of mycopy to {42}
log myList
log mycopy
log listItem1
The log shows this:
(*42, 2*)
(*42, 2*)
(*1*)
-- Michelle
--
Peter pull at St. Taffy's tonight! (Or is it the other way around?)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden