Array name in a variable?

May 20, 2008
10,498
77
Syracuse, NY, USA
Is there a syntax which will allow me to reference an element of an array when I have the name of that array in a variable? Here's a simple partial example.
Code:
:showarray [arrayname]
echo ???????[0] & rem What do I put here if I want to see the 0th element in the array?
return
 
May 20, 2008
10,498
77
Syracuse, NY, USA
Is there a syntax which will allow me to reference an element of an array when I have the name of that array in a variable? Here's a simple partial example.
Code:
:showarray [arrayname]
echo ???????[0] & rem What do I put here if I want to see the 0th element in the array?
return
It's a workaround, but this works.
Code:
:showarray [arrayname]
set b=%%%arrayname[0]
echo %b
return
Here it is explicitly.
Code:
v:\> setarray a[1]

v:\> set a[0]=foo

v:\> set arrayname=a

v:\> echo %%%arrayname[0]
%a[0]

v:\> set b=%%%arrayname[0]

v:\> set b
%a[0]

v:\> echo %b
foo