array: why does this not work?

Dar Scott dsc at swcp.com
Mon Dec 2 02:56:01 EST 2002


On Sunday, December 1, 2002, at 11:50 PM, Oliver Hardt wrote:

> function gF_getA pArray, pKey
>   get pArray[pKey]
>   return it
> end gF_getA

**********************
function fetch e, k
   return e[k]
end fetch

function makeA
   local x
   put "abc" into x["a"]
   put "a" into x["b"]
   return x
end makeA

on mouseUp
   local y
   put "eee" into y["v"]
   put fetch(y,"v") & lineFeed into field "Report"
   put fetch(makeA(),"a") & lineFeed after field "Report"
   put makeA() into y
   put fetch(y,"a") & lineFeed after field "Report"
end mouseUp
********************

This produces this:
eee

abc

I had expected this:
eee
abc
abc

An array can be a parameter.  An array can be returned by a function.  
But it looks like it can't be both at the same time.  Rats.

Maybe the test for your function has the same problem.

Dar




More information about the use-livecode mailing list