diff 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
line wrap: on
line diff
--- a/core/src/luan/LuanPropertyMeta.java	Mon May 04 23:40:52 2015 -0600
+++ b/core/src/luan/LuanPropertyMeta.java	Mon May 04 23:44:25 2015 -0600
@@ -54,8 +54,10 @@
 
 	@Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException {
 		Object obj = setters(tbl).rawGet(key);
-		if( obj == null )
-			throw luan.exception("can't set property '"+key+"'");
+		if( obj == null ) {
+			tbl.rawPut(key,value);
+			return;
+		}
 		if( !(obj instanceof LuanFunction) )
 			throw luan.exception("set for '"+key+"' isn't a function");
 		LuanFunction fn = (LuanFunction)obj;