conPeek Function

Retrieves a specific element from a container.


anytype conPeek(container container, int number)

Parameter

Description

container

The container to return an element from.

number

The position of the element to return.

Specify 1 to get the first element.

The element in the container at the position specified by the number parameter.

The conPeek function automatically converts the peeked item into the expected return type. Strings can automatically be converted into integers and real numbers, and vice versa.

static void conPeekExample(Args _arg)
{
    container c;
    int i;
    ;
 
    c = conIns(["item1", "item2"], 1);  
    for (i = 1 ; i <= conLen(c) ; i++)  
    {
        print conPeek(c, i);
    }
    pause;
}

Community Additions

ADD
Show: