referencing arrays

Alex Rice alex at mindlube.com
Sun Nov 2 16:59:09 EST 2003


On Nov 2, 2003, at 1:19 PM, rand valentine wrote:

>   Hi, I have a simple question, and my apologies to the gurus for 
> taking your time -- i still can't search the archives.

My archives search is current
<http://mindlube.com/cgi-bin/search-use-rev.cgi>

>   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 way is to evaluate the expression with do or value:
put the value of (theArrayName & "[" & quote & "@" & quote & "]")

This is an area where custom property sets is more expressive:

set the customProperties[theArrayName] to someArray
set the customPropertySet of me to theArrayName
put the "@" of me

Hope this helps,

Alex Rice <alex at mindlube.com> | Mindlube Software | 
<http://mindlube.com>

what a waste of thumbs that are opposable
to make machines that are disposable  -Ani DiFranco



More information about the use-livecode mailing list