• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Reference to a list stops working when put inside a function?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Reference to a list stops working when put inside a function?
      • From: email@hidden
  • Prev by Date: Re: renaming a usb memory stick using applescript
  • Next by Date: Re: Reference to a list stops working when put inside a function?
  • Previous by thread: anyone else using webservices?
  • Next by thread: Re: Reference to a list stops working when put inside a function?
  • Index(es):
    • Date
    • Thread