Mercurial Hosting > luan
comparison src/luan/LuanTable.java @ 1566:364859d29ff5
handle nil keys
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 12 Nov 2020 16:59:47 -0700 |
parents | 8fbcc4747091 |
children | c922446f53aa |
comparison
equal
deleted
inserted
replaced
1565:44e444a8da64 | 1566:364859d29ff5 |
---|---|
212 | 212 |
213 public Object rawPut(Object key,Object val) throws LuanException { | 213 public Object rawPut(Object key,Object val) throws LuanException { |
214 if( immutable ) | 214 if( immutable ) |
215 throw new LuanException("table is immutable"); | 215 throw new LuanException("table is immutable"); |
216 check(); | 216 check(); |
217 if( key==null ) | |
218 throw new LuanException("table index is nil"); | |
217 Integer iT = Luan.asInteger(key); | 219 Integer iT = Luan.asInteger(key); |
218 if( iT != null ) { | 220 if( iT != null ) { |
219 int i = iT - 1; | 221 int i = iT - 1; |
220 if( list != null || i == 0 ) { | 222 if( list != null || i == 0 ) { |
221 if( i == list().size() ) { | 223 if( i == list().size() ) { |