comparison core/src/luan/LuanPropertyMeta.java @ 451:d62c35a5cd6b

allow setting non-properties in property table
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 May 2015 23:44:25 -0600
parents d9df6d6cb927
children 6cc2f047019b
comparison
equal deleted inserted replaced
450:4b8281c5c5af 451:d62c35a5cd6b
52 return true; 52 return true;
53 } 53 }
54 54
55 @Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException { 55 @Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException {
56 Object obj = setters(tbl).rawGet(key); 56 Object obj = setters(tbl).rawGet(key);
57 if( obj == null ) 57 if( obj == null ) {
58 throw luan.exception("can't set property '"+key+"'"); 58 tbl.rawPut(key,value);
59 return;
60 }
59 if( !(obj instanceof LuanFunction) ) 61 if( !(obj instanceof LuanFunction) )
60 throw luan.exception("set for '"+key+"' isn't a function"); 62 throw luan.exception("set for '"+key+"' isn't a function");
61 LuanFunction fn = (LuanFunction)obj; 63 LuanFunction fn = (LuanFunction)obj;
62 luan.call(fn,new Object[]{value}); 64 luan.call(fn,new Object[]{value});
63 } 65 }