Mercurial Hosting > luan
diff src/luan/modules/BasicLuan.java @ 1794:04ac5f2771c8
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 30 Dec 2023 18:41:35 -0700 |
parents | 164c6ea53147 |
children | ca98dee04e08 |
line wrap: on
line diff
--- a/src/luan/modules/BasicLuan.java Thu Dec 28 11:36:24 2023 -0700 +++ b/src/luan/modules/BasicLuan.java Sat Dec 30 18:41:35 2023 -0700 @@ -59,11 +59,17 @@ size = list.size(); } - @Override public Object[] call(Luan luan,Object[] args) { + @Override public Object[] call(Luan luan,Object[] args) throws LuanException { if( i >= size ) return LuanFunction.NOTHING; - Object val = list.get(i++); - return new Object[]{i,val}; + try { + Object val = list.get(i++); + return new Object[]{i,val}; + } catch(IndexOutOfBoundsException e) { + if( size != list.size() ) + throw new LuanException("list was modified during ipairs iteration"); + throw e; + } } @Override public boolean isImmutable() {