Skip to content

[BUG] WeightedContainer: can't iterate while I iterate #413

@Suor

Description

@Suor
local cont = WeightedContainer();
cont.add("a", 10);
cont.add("b", 20);
cont.add("c", 30);
cont.add("d", 40);

foreach (k, v in cont) {
    print(k + " " + v + "\n")
    foreach (k2, v2 in cont) {
        print("inner " + k2 + " " + v2 + "\n")
    }
}

Result:

a 10
inner a 10
inner c 30
inner b 20
inner d 40

AN ERROR HAS OCCURRED [arith op + on between 'null' and 'integer']

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions