comparison core/src/luan/impl/SetTableEntry.java @ 405:3e68917a0dc6

add LuanMeta
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 29 Apr 2015 11:10:11 -0600
parents d55e873e1f0d
children 8fbb961aabd5
comparison
equal deleted inserted replaced
404:d55e873e1f0d 405:3e68917a0dc6
3 import luan.LuanException; 3 import luan.LuanException;
4 import luan.LuanTable; 4 import luan.LuanTable;
5 import luan.Luan; 5 import luan.Luan;
6 import luan.LuanFunction; 6 import luan.LuanFunction;
7 import luan.LuanSource; 7 import luan.LuanSource;
8 import luan.LuanMeta;
8 import luan.modules.JavaLuan; 9 import luan.modules.JavaLuan;
9 10
10 11
11 final class SetTableEntry extends CodeImpl implements Settable { 12 final class SetTableEntry extends CodeImpl implements Settable {
12 private final Expr tableExpr; 13 private final Expr tableExpr;
39 if( h instanceof LuanFunction ) { 40 if( h instanceof LuanFunction ) {
40 LuanFunction fn = (LuanFunction)h; 41 LuanFunction fn = (LuanFunction)h;
41 luan.bit(se).call(fn,"__newindex",new Object[]{t,key,value}); 42 luan.bit(se).call(fn,"__newindex",new Object[]{t,key,value});
42 return; 43 return;
43 } 44 }
45 if( h instanceof LuanMeta ) {
46 LuanMeta meta = (LuanMeta)h;
47 meta.__newindex(luan,table,key,value);
48 return;
49 }
44 newindex(luan,h,key,value); 50 newindex(luan,h,key,value);
45 } 51 }
46 if( !JavaLuan.__newindex(luan,t,key,value) ) 52 if( !JavaLuan.__newindex(luan,t,key,value) )
47 throw luan.bit(se).exception( "attempt to index '"+tableExpr.se().text()+"' (a " + Luan.type(t) + " value)" ); 53 throw luan.bit(se).exception( "attempt to index '"+tableExpr.se().text()+"' (a " + Luan.type(t) + " value)" );
48 } 54 }