Reference to a list stops working when put inside a function?
Reference to a list stops working when put inside a function?
- Subject: Reference to a list stops working when put inside a function?
- From: Jugdish <email@hidden>
- Date: Thu, 25 Sep 2008 14:59:34 -0700
Hi, I'm having problems using an object of type "reference." Here's a
simple example of what I'm trying to do:
set myList to {}
set myListRef to a reference to myList
repeat with n from 1 to 100
copy n to the end of myListRef
end repeat
This code works perfectly. But if I put the exact same block of code
inside a function, suddenly it doesn't work:
on myFunction()
set myList to {}
set myListRef to a reference to myList
repeat with n from 1 to 100
copy n to the end of myListRef
end repeat
end myFunction
myFunction()
The above code generates this error: "Can't make last insertion point
of myList into type reference."
I can't for the life of me figure out why putting that code inside a
function would suddenly cause an error. Can someone enlighten me on
this?
Also, in case it's relevant, I'm running:
- OS X 10.4.11 Intel
- Applescript 1.10.7
- Script Editor 2.1.1
Many thanks for your help!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden