referencing arrays
Phil Davis
davis.phil at comcast.net
Sun Nov 2 17:52:09 EST 2003
> -----Original Message-----
> From: use-revolution-bounces at lists.runrev.com
> [mailto:use-revolution-bounces at lists.runrev.com]On Behalf Of rand
> valentine
> Sent: Sunday, November 02, 2003 12:19 PM
> To: use-revolution at lists.runrev.com
> Subject: referencing arrays
>
>
> Hi, I have a simple question, and my apologies to the gurus for
> taking your time -- i still can't search the archives.
>
> I have a set of arrays, titled arrayN, arrayV, arrayA
>
> I want to be able to build the name of the array I need to refer to
> on the fly, e.g.,
>
> put "array" & "N" into theArrayName
>
> put theArrayName["@"]
>
> this does not work -- using a variable for the name of the array
> causes the array not to be properly referenced. What am I doing wrong,
> or what can one do to actually build an array reference of this sort
> that works?
One approach:
get ("put array" & tSomeCharacter & "[" & tKeyValue & "] into tValue")
do it
-- now tValue contains the value pulled from arrayN[x]
Another version of this approach:
put arrayValue("N",tKeyValue) into tMyValue
...
...
function arrayValue pArraySuffix, pArrayKey
get ("put array" & pArraySuffix & "[" & pArrayKey & "] into tValue")
do it
return tValue
end arrayValue
Hope this helps.
Phil Davis
>
> rand valentine
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list