inext returns nil,nil on missing second parameter

Issue #51 open
mezzodrinker created an issue

Take the following script:

table = { 1, 2, [42]=42 }
i,v = inext(table)
print(i, '->', v)

You would expect the output to be 1 -> 1, since a call to next with its second parameter being nil also gives you the initial element from the table. However, the output is nil -> nil because a missing second parameter will be interpreted as index 0which is not present in any list. Hence, the second check in MtsTable.getINext will always cause the function to return nil in this situation.

Comments (3)

  1. Log in to comment