array: can it be returned by a function?

Dar Scott dsc at
Mon Nov 25 20:44:01 EST 2002

On Monday, November 25, 2002, at 06:14 PM, Dar Scott wrote:

> 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:
on mouseUp
   local x, y
   put "123" into y["C"]
   put fillArray(y) into x
   put x["A"] & x["B"] & x["C"] into field "Report"
end mouseUp

function fillArray theArray
   local arrayHolder
   put  theArray into arrayHolder
   put "  abc  " into arrayHolder["A"]
   put "  xyz  " into arrayHolder["B"]
   return arrayHolder
end fillArray

And this, too!  An array can be passed as an arg.

The field gets "  abc    xyz  123"!

There's a story about the fellow who bought a chainsaw and after cutting 
a cord of wood complained to the salesman that it didn't seem to 
increase his output as the salesman indicated.  The salesman asked him 
to bring it in and he would look at it.  When the salesman fired it up, 
the woodsman jumped back and said, "What's that noise??!!"

I'm that woodsman.

Dar Scott

More information about the Use-livecode mailing list