Vector_new1

Homepage
Containers

Creates a new Vector object containing the elements of the specified List object.

VectorObject := Vector_new1(ListObject)

Parameters

ListObject The List object whose contents will be placed into the new Vector.

Return Value

Address for the newly created Vector object.

Remarks

If the system has insufficient memory to create the object (very rare), zero will be returned.

The elements in the list are copied (not cloned) and the lock count for each element will be increased by one to reflect being stored in another location.

Related

Vector_new, Vector_destroy

Vector

Examples

;Creates a new Array (of length 10)
myArray := Array_new(10)

Array_set(myArray, 2, String_new("This is index 2"))
Array_set(myArray, 5, String_new("Index 5 has a value"))

;Creates a new Vector containing the elements in myArray
myVector := Vector_new1(myArray)

;Iterate through each Vector element and output its contents
Loop, % Vector_size(myVector)
{
    MsgBox, % "myVector[" A_Index "] = " Vector_get(myVector, A_Index)
}

Homepage  |  Containers