changeset 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 4b8281c5c5af
children 56c23aa70045
files core/src/luan/LuanPropertyMeta.java
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
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;