comparison core/src/luan/LuanTable.java @ 428:df95199ca4c0

rename __newindex to __new_index
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 02 May 2015 20:10:31 -0600
parents dae264ad6a7b
children f28320fd671d
comparison
equal deleted inserted replaced
427:dae264ad6a7b 428:df95199ca4c0
125 return null; 125 return null;
126 return map.get(key); 126 return map.get(key);
127 } 127 }
128 128
129 public void put(LuanState luan,Object key,Object value) throws LuanException { 129 public void put(LuanState luan,Object key,Object value) throws LuanException {
130 Object h = getHandler("__newindex"); 130 Object h = getHandler("__new_index");
131 if( h==null || rawGet(key)!=null ) { 131 if( h==null || rawGet(key)!=null ) {
132 rawPut(key,value); 132 rawPut(key,value);
133 return; 133 return;
134 } 134 }
135 if( h instanceof LuanFunction ) { 135 if( h instanceof LuanFunction ) {
136 LuanFunction fn = (LuanFunction)h; 136 LuanFunction fn = (LuanFunction)h;
137 luan.call(fn,"__newindex",new Object[]{this,key,value}); 137 luan.call(fn,"__new_index",new Object[]{this,key,value});
138 return; 138 return;
139 } 139 }
140 if( h instanceof LuanMeta ) { 140 if( h instanceof LuanMeta ) {
141 LuanMeta meta = (LuanMeta)h; 141 LuanMeta meta = (LuanMeta)h;
142 meta.__newindex(luan,this,key,value); 142 meta.__new_index(luan,this,key,value);
143 return; 143 return;
144 } 144 }
145 if( h instanceof LuanTable ) { 145 if( h instanceof LuanTable ) {
146 LuanTable tbl = (LuanTable)h; 146 LuanTable tbl = (LuanTable)h;
147 tbl.put(luan,key,value); 147 tbl.put(luan,key,value);
148 return; 148 return;
149 } 149 }
150 throw luan.exception("invalid type "+Luan.type(h)+" for metamethod __newindex"); 150 throw luan.exception("invalid type "+Luan.type(h)+" for metamethod __new_index");
151 } 151 }
152 152
153 public void rawPut(Object key,Object val) { 153 public void rawPut(Object key,Object val) {
154 Integer iT = Luan.asInteger(key); 154 Integer iT = Luan.asInteger(key);
155 if( iT != null ) { 155 if( iT != null ) {