Table.Remove not working properly

Issue #8 resolved
Fabian Maurer created an issue

The following code

table = {1,2,3};

for k,v in next, table do
    print(k, "->", v);
end

Table.remove(table, 2);

for k,v in next, table do
    print(k, "->", v);
end

outputs

1->3
2->2
3->1

1->3
2->1
3->1

while I would expect it to output

1->3
2->2
3->1

1->3
3->1

Comments (4)

  1. mezzodrinker

    Same for this code:

    > table = {"foo", "bar", "baz"}; Table.Remove(table, 1); for k,v in next,table do print(k,"->",v); end
    1->bar
    2->foo
    3->foo
    
  2. Log in to comment