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.

The first element is specified by the number 1.

element

One or more elements to replace. Separate multiple elements by commas.

The new container.

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: