array: can it be returned by a function?

Dar Scott dsc at swcp.com
Mon Nov 25 20:21:01 EST 2002


On Monday, November 25, 2002, at 05:48 PM, David Vaughan wrote:

> Yes they can. I have done this and just tested it again.

Wow!  I didn't know that.

I tried it and it works:
***************************************
local test

on mouseUp
   local anotherVar
   put "abc" into test["A"]
   put "xyz" into test["B"]
   put someFun() into anotherVar
   put anotherVar["A"] & anotherVar["B"] into field "Report"
end mouseUp

function someFun
   return test
end someFun
***************************************

I had tried this:

put someFun()["A"] after field "Report"

which wouldn't compile and then assumed it couldn't be done.

One could make a function to to the lookup, I suppose.

This is interesting.  Values can be arrays as well as strings in some 
sense.  (They can be also numbers, not quite masquerading as strings.)  
I like the idea of arrays as values rather than a kind of variable.  I 
have used that in LabView.

Dar Scott




More information about the Use-livecode mailing list