I thought I read that arrays are already passed by reference even without the byref decorator. On 12/2/14, Jim Snowbarger <snowman@xxxxxxxxxxxxxxx> wrote: > If you want to call a function, and have it generate an array of data and > return it back to you, what is the right way to do that? > According to the script manager, it seems that a function can not have an > array data type, so apparently you can't return an array. Is that > correct? > > > > So, do you need to pass the array in by reference, and modify it inside the > function? > > If you do that, I presume the array needs to actualy be created with the > "new" statement out in the calling function. For example: > > > > Var stringArray s > > S = new stringArray[30] > > myFunc(s) > > > > But, in this example, you would need to be able to declare the function > parameter as a byRef array. And, > > According to the script manager, a parameter can not be of an array type. > > > > But, the following fragment of jibberish will compile, but does not work. > > > > void function x(stringArray byref s) > > s[0] = "hello" > > EndFunction > > > > Script test () > > var > > stringArray a > > SayString ("beep") > > Let a = new stringArray[5] > > x(a) > > SayString (a[0]) > > EndScript > > > > Compiles great, but doesn't speak the word, hello. > > > > The following also compiles, and it doesn't work either! > > > > stringArray function x() > > var > > stringArray s > > > > s = new stringArray[5] > > s[0] = "hello" > > return(s) > > EndFunction > > > > Script test () > > var > > stringArray a > > a = x() > > SayString (a[0]) > > EndScript > > > > Can somebody set me straight here? How is this supposed to be done? > > Thanks. > > > > > > > > __________� > > View the list's information and change your settings at > //www.freelists.org/list/jawsscripts > > -- Soronel Haetir soronel.haetir@xxxxxxxxx __________� View the list's information and change your settings at //www.freelists.org/list/jawsscripts