conPoke Function

Modifies a container by replacing one or more of the existing elements.


container conPoke(
    container container,
    int start,
    anytype element,
    ...)

Parameter

Description

container

The container to modify.

start

The position of the first element to replace.

element

One or more elements to replace, separated by commas.

The first element of the container is specified by the number 1.

The new container with the new elements.

static void conPokeExample(Args _arg)
{
    container c1 = ["item1", "item2", "item3"];
    container c2;
    int i;
 
    void conPrint(container c)
    {
        for (i = 1 ; i <= conLen(c) ; i++)
        {
            print conPeek(c, i);
        }
    }
    ;
    conPrint(c1);
    c2 = conPoke(c1, 2, "PokedItem");
    print "";
    conPrint(c2);
    pause;
}

Community Additions

ADD
Show: