difference between function and command and sending parameters
Mark Smith
lists at futilism.com
Mon Dec 1 18:18:28 EST 2008
William, if your example is as simple as it seems, I'd probaly not
bother with an array, and use chunks instead,
However, for bigger data I'd do something like this, in Rev 3.0
on mouseUp
put myTest() into tBigArray
put tBigArray[1] into myArray
put tBigArray[2] into mySimpleVariable
put the keys of myArray
end mouseUp
function myTest
put "app" into tArray[1][1]
put "win" into tArray[1][2]
pit "lin" into tArray[1][3]
put 2 into tArray[2]
return tArray
end myTest
If you're still pre-3.0 then something like
on mouseUp
put myTest() into tArray
put tArray["othervalue"] into mySimpleVariable
delete variable tArray["othervalue"]
put the keys of tArray
end mouseUp
function myTest
put "app" into tArray[1]
put "win" into tArray[2]
put "lin" into tArray[3]
put 2 into tArray["othervalue"]
end myTest
best,
Mark
On 1 Dec 2008, at 22:19, william humphrey wrote:
> I noticed that you can't return a mix of an array and a variable. This
> doesn't work (it only works if the params are both simple variables
> or if
> you only have one parm - the array) :
>
> *on* mouseUp
>
> *put* the first item of MyTest() into myArray
>
> *put* the keys of myArray
>
> *end* mouseUp
>
>
> *function* MyTest
>
> *put* "app" into pfirst[1]
>
> *put* "win" into pfirst[2]
>
> *put* "lin" into pfirst[3]
>
> *put* 2 into psecond
>
> *return* pfirst, psecond
>
> *end* MyTest
>
>
> I needed to do something like the above as the second parameter held a
> different data item so now I'm trying to figure out another way to
> do it.
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list