inext throws ArrayIndexOutOfBoundsException when using last index as second parameter

Issue #52 open
mezzodrinker created an issue

Take the following script:

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

When going by Lua’s description of ipairs as well as the behaviour of next, the above should cause an output of nil -> nil because inext would return the index and assigned value directly following 2 (i.e. 3), which is not present in the table. Instead, MobTalkerScript throws a java.lang.ArrayIndexOutOfBoundsException.

Comments (2)

  1. Log in to comment