array: can it be returned by a function?

Oliver Hardt hardt at u.arizona.edu
Mon Nov 25 23:45:01 EST 2002


David:  thank you very much -- it appears that i simply did not 
understand that in order to put the values of the array into a field 
(or message box), i need to use the combine command.  you solved my 
problem!  thanks a lot!  best, olli.



11/26/02, David Vaughan wrote:

>On Tuesday, Nov 26, 2002, at 13:01 Australia/Sydney, Oliver Hardt wrote:
>
>>  -- this function gets a tab-separated list of
>>  -- values (ppData) and a tab-separated list of
>>  -- keys (ppKeys).  then an array is filled up
>>  -- with the ppData values and returned
>>
>>  function gF_LoadPPRec pData,pKeys
>>    put empty into lPPArray
>>    set the itemDelimiter to tab
>>    repeat with i = 1 to the number of items of pKeys
>>      put item i of pData into lPPArray[(item i of pKeys)]
>>    end repeat
>>
>>    return lPPArray
>>  end gF_LoadPPRec
>
>Oliver
>
>I wrote this:
>on mouseUp
>   put 1 & tab & 2 & tab & 3 & tab & 4 into pKeys
>   put "Freddo" & tab & "Frog" & tab & "was" & tab & "here" into pData
>   get gf_LoadPPRec(pData,pKeys)
>   combine it with return and comma
>   put it into field "f2"
>end mouseUp
>
>function gF_LoadPPRec pData,pKeys
>   put empty into lPPArray
>   set the itemDelimiter to tab
>   repeat with i = 1 to the number of items of pKeys
>     put item i of pData into lPPArray[(item i of pKeys)]
>   end repeat
>   return lPPArray
>end gF_LoadPPRec
>
>which you can see includes your untouched function. It simply 
>exercises it; and it worked perfectly, producing:
>1,Freddo
>2,Frog
>3,was
>4,here



More information about the use-livecode mailing list