Extension talk:Arrays/archive

such a pragmatic extension thanks

Arraydefine
On your examples page you use something like

which would create an array 1,2,3. But it's not documented here yet. Is this an permanent feature allready? Are there more values for this parameter? --Danwe 22:13, 25 February 2009 (UTC)

Well, the feature has not yet been released because of some concerns on the design of function interface (users may want to set multiple values on the last parameter, e.g. make it unique, make it sort). would it be natural to use '&' to separate the values? - Lidingpku 14:04, 17 March 2009 (UTC)
 * I don't know, I personal wouldn't use & but there could be reasons to do so. I like the last parameter to sort or unique in the same step and I already use this feature. --Danwe 20:41, 25 April 2009 (UTC)


 * Ok, the option (unique, sort, and print) has been added in version 1.2.1 -- Lidingpku 15:39, 3 May 2009 (UTC)

Arrayreset
I think #arrayreset is not very hepful in it's actual function. In most cases I have a template where I create a temporary array and I want to destory it there. But when you use  there, it will destroy ALL arrays, also these which were not defined in that template which are still needed in some cases. So perhaps it would be better if you could use that function #arrayreset alternatively like that:  or even better:. Shure, you can also use but I think it would be more pretty if you could use the #arrayreset function because you can see on first fiew where an array is going to be defined and where it will be destroyed. --Danwe 22:22, 25 February 2009 (UTC)

ok, one option has been added to #arrayreset to support this idea. you can now use to unset a selection of arrays. - Lidingpku 14:28, 17 March 2009 (UTC)

Bug in Arrayresets if no arrays are defined before
If you use #arrayreset before you have defined a array before, you will get a error on the top of the page (but only on the preview page). Sometimes I reset arrays on the beginning of a template because I need to reset some template internal arrays. If the template is used on the top of the page this creates an error on the preview page. --Danwe 14:57, 18 May 2009 (UTC)

Arrayslice
I'm using arrayslice and am using 1 and 10 for the offset and length - then I am using arrayprint to post the 10 values in the new array. The extension is correctly posting 10 values; however, the array is starting with the second value of the array rather than the first. I have tried to post with an offset of zero and have even posted an arrayprint with an arrayslice with no length - the first value still doesn't show. Is this a bug, or am I doing something wrong?
 * Looks like they fixed that problem yesterday. Please youse the signature for the next time you add something to the talk page! --Danwe 20:39, 25 April 2009 (UTC)

I found another bug in arrayslice: This should return an void array because there are only 3 items inside the array. But instead of a void array the function returns the whole array. This is a problem with using variable parameters where you don't know before if the offset is bigger as the values. The bug appears for offsets >= arraysize. --Danwe 16:47, 28 April 2009 (UTC)


 * it has been fixed in version 1.2.1, Lidingpku 15:55, 3 May 2009 (UTC)

Arrayindex
If the arrayitem with the index doesn't exist or the index has an void entry, it should be possible to get an alternative value by adding this value as third parameter like:.

By the way, I need to know if an array exists to cache the content of an array for a template so save some time. I do thant in many templates. --Danwe 19:26, 7 May 2009 (UTC)

zero bug in arraydefine and arrayunique!
I was going to be crazy because I couldn't find a bug in my template. Finally I recorgnized this bug isn't in my template, it must be a ArrayExtension bug...

This bug is very strange. Whenever you have a zero "0" in your Array it happens. Arrayunique removes the "0" zero value! Even so does the unique command in Arraydefine. But that's not the only thing. When you define  you get a void array with #arraysize = 0. BUT if you have  the #arraysize is 2 and the "0" is in the array. But only as long as you don't run an #arrayunique on the array. This will remove the "0" again.

I don't know if there are any other functions which have the same effect on the zero. Arrayslice for example works well with zeros. Hope you can fix this bug soon. Actually I have some number arrays where zeros can appear as well. --Danwe 14:08, 17 May 2009 (UTC)

New Functions
This extension looks really useful but it seems to be lacking a couple features, specifically functions to do push, pop, get and concat. The parserfunctions would look something like: - if key doesn't exist, it is created; direction indicates beginning or end; so you can do FIFO and FILO - pops the value from array and returns it, direction indicates beginning or end - returns the value at the indicated position, position could be positive or negative index.

-- BlindWanderer 16:00, 26 May 2009 (UTC)