A [v0.7.5]

Author: DerRaphael Last Modified: nonexistent


Work with an array structure with one Variable only. With these functions Array handling is similiar to real arrays. The content of the variable will be parsed.

A_Array(byRef Array)
A_ArrayMM(&tmpArray, &Array, aSize)
A_Count(byRef Array)
A_Del(ByRef Array, Item=-1)
A_Dump(ByRef Array)
A_Explode(ByRef Array, dString, sString, Limit=0, trimChars="", trimCharsIsRegEx=False, dStringIsRegEx=False)
A_Get(ByRef Array, Index)
A_Implode(ByRef Array, glue=" ")
A_Init(Array)
A_Length(ByRef Array)
A_Merge(Byref Array, ByRef sArray)
A_Pop(ByRef Array)
A_Put(ByRef Array, ByRef Data, Index=-1, dSize=-1)
A_Shift(ByRef Array)
A_Size(ByRef Array)
A_Slice(ByRef Array, ByRef sArray, Start, End)
A_Swap(ByRef Array, IdxA, IdxB)

For the functions's parameters and return value, please see it's source code or the document.

Remarks

The documentation is copied part from first post of DerRaphael from the discussion thread.

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=36600

License

The functions is an open source item under the EUPL license.
For details, please see EUPL-EN.pdf

Example

; #Include a.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

Loop, 5 ; Add 5 elements to Array
{
   VarSetCapacity(t,5,asc("0")+A_Index)
   A_Put(MyArray,t)
}
Data := "1234567890abcdefghijklmnopqrstuvwxyz"
A_Put(MyArray, Data, 5) ; Change fifth entry in variable.
MsgBox, , Array Dump, % A_Dump(MyArray)
Loop, 5 ; Retrieve all elements via loop
{
   ArrayElements .= "ArrayElement #" A_Index ": " . A_Get(MyArray,A_Index) "`n"
}
MsgBox, , Via Loop retrieved, %ArrayElements%