Mercurial Hosting > luan
comparison core/src/luan/impl/SetTableEntry.java @ 426:23a93c118042
fix LuanTable.get() to use metatables
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 May 2015 18:44:20 -0600 |
parents | b31d614343e8 |
children | dae264ad6a7b |
comparison
equal
deleted
inserted
replaced
425:0a2fb80907f9 | 426:23a93c118042 |
---|---|
25 | 25 |
26 private void newindex(LuanStateImpl luan,Object t,Object key,Object value) throws LuanException { | 26 private void newindex(LuanStateImpl luan,Object t,Object key,Object value) throws LuanException { |
27 if( t instanceof LuanTable ) { | 27 if( t instanceof LuanTable ) { |
28 LuanTable table = (LuanTable)t; | 28 LuanTable table = (LuanTable)t; |
29 Object h = table.getHandler("__newindex"); | 29 Object h = table.getHandler("__newindex"); |
30 if( h==null || table.get(key)!=null ) { | 30 if( h==null || table.rawGet(key)!=null ) { |
31 try { | 31 try { |
32 table.put(key,value); | 32 table.put(key,value); |
33 } catch(IllegalArgumentException e) { | 33 } catch(IllegalArgumentException e) { |
34 throw luan.bit(se).exception(e); | 34 throw luan.bit(se).exception(e); |
35 } catch(UnsupportedOperationException e) { | 35 } catch(UnsupportedOperationException e) { |