www.webdeveloper.com
Results 1 to 2 of 2

Thread: how to return an array from a function

  1. #1
    Join Date
    Oct 2003
    Posts
    235

    how to return an array from a function

    Code:
    function retArray()
    
    Dim myArray(1)
    
    myArray(0) = "The record you have chosen is "
    myArray(1) = "215"
    
    retArray = myArray
    
    end function
    
    Dim recInfo(1)
    
    recInfo = retArray()
    Im getting a "Type mismatch" when I try to return an array from a function into a local array as shown. Can anyone direct me to a document or explain to me the proper syntax for a function that returns an array into a local array?

    thanks

  2. #2
    Join Date
    Oct 2003
    Posts
    235

    Re: how to return an array from a function

    Code:
    Dim recInfo
    
    recInfo = retArray()
    Ok I'm replying to myself in the hopes that this benefits someone else.

    In the local script that calls the function: don't declare the variable that will hold the return value as an array as shown. All documentation/examples I found didn't abide by this but it worked for me by not doing so.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles