Board Thread:Support Requests - Getting Technical/@comment-961279-20161113063046

I have an idea for automating some templates, and a good way to do this would be with a two-dimensional array. I have done some checking, but I think MediaWiki only supports one-dimensional arrays. If that's the case, I can simulate a two dimensional array by creating several one-dimensional arrays, like this:


 *  
 *  
 *  
 *  

A standard way to retrieve info out of an array is with the ArrayIndex command, like this:
 *  

This example would report back "17" from the "a3" array.

What I'm not sure about is if the Arrays extension can handle extracting data from an array if you're building the array name to be checked from two separate pieces. For example, using a FOR loop to cycle through the arrays. First time through, the loop counter is 1, so you build the array name by appending the counter value onto "a" to get "a1".

For this example,   would be the loop counter, and the value to be retrieved is done with this:
 *  

When the loop value is 1, then this would report "15" for the result.

Would doing an in-line concatination of the array name work as shown above, or would I have to do the concatination ahead of time and put it into a standard variable like or in a defined variable?

The other part I need some advice on is finding out which command in the Array extension would let me store the results in a variable instead of just printing it or putting it into a new array. The idea is that I would do a loop though the arrays and do a comparison to see if each array matched a criteria like "Yellow". If so, retrieve the "17" value, store that in a variable, and exit the loop gracefully since no futher search results is needed. Then different calculations can be performed on the 17 in the variable to get other values.

The number of arrays will increase as time goes on, so there will be a value at the top that will control how long the loop runs, like this:   <ac_metadata title="Simulating two-dimensional arrays" related_topics="Topic:Parser Functions"> </ac_metadata>