changeset 427:dae264ad6a7b

fix LuanTable.put() to use metatables
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 01 May 2015 19:29:07 -0600
parents 23a93c118042
children df95199ca4c0
files core/src/luan/LuanMeta.java core/src/luan/LuanPropertyMeta.java core/src/luan/LuanTable.java core/src/luan/impl/SetTableEntry.java core/src/luan/impl/TableExpr.java core/src/luan/modules/BasicLuan.java core/src/luan/modules/HtmlLuan.java core/src/luan/modules/IoLuan.java core/src/luan/modules/JavaLuan.java core/src/luan/modules/PackageLuan.java core/src/luan/modules/PickleClient.java core/src/luan/modules/PickleCon.java core/src/luan/modules/PickleServer.java core/src/luan/modules/TableLuan.java lucene/src/luan/modules/lucene/LuceneDocument.java lucene/src/luan/modules/lucene/LuceneIndex.java lucene/src/luan/modules/lucene/LuceneSearcher.java lucene/src/luan/modules/lucene/LuceneWriter.java web/src/luan/modules/web/HttpServicer.java
diffstat 19 files changed, 137 insertions(+), 133 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/LuanMeta.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/LuanMeta.java	Fri May 01 19:29:07 2015 -0600
@@ -53,11 +53,11 @@
 
 	public LuanTable newMetatable() {
 		LuanTable mt = new LuanTable();
-		mt.put( "__index", this );
-		mt.put( "__pairs", this );
-		mt.put( "__tostring", this );
+		mt.rawPut( "__index", this );
+		mt.rawPut( "__pairs", this );
+		mt.rawPut( "__tostring", this );
 		if( canNewindex() )
-			mt.put( "__newindex", this );
+			mt.rawPut( "__newindex", this );
 		return mt;
 	}
 
--- a/core/src/luan/LuanPropertyMeta.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/LuanPropertyMeta.java	Fri May 01 19:29:07 2015 -0600
@@ -64,9 +64,9 @@
 
 	@Override public LuanTable newMetatable() {
 		LuanTable mt = super.newMetatable();
-		mt.put( "get", new LuanTable() );
-		mt.put( "set", new LuanTable() );
-		mt.put( "type", "property" );
+		mt.rawPut( "get", new LuanTable() );
+		mt.rawPut( "set", new LuanTable() );
+		mt.rawPut( "type", "property" );
 		return mt;
 	}
 
--- a/core/src/luan/LuanTable.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/LuanTable.java	Fri May 01 19:29:07 2015 -0600
@@ -126,7 +126,31 @@
 		return map.get(key);
 	}
 
-	public void put(Object key,Object val) {
+	public void put(LuanState luan,Object key,Object value) throws LuanException {
+		Object h = getHandler("__newindex");
+		if( h==null || rawGet(key)!=null ) {
+			rawPut(key,value);
+			return;
+		}
+		if( h instanceof LuanFunction ) {
+			LuanFunction fn = (LuanFunction)h;
+			luan.call(fn,"__newindex",new Object[]{this,key,value});
+			return;
+		}
+		if( h instanceof LuanMeta ) {
+			LuanMeta meta = (LuanMeta)h;
+			meta.__newindex(luan,this,key,value);
+			return;
+		}
+		if( h instanceof LuanTable ) {
+			LuanTable tbl = (LuanTable)h;
+			tbl.put(luan,key,value);
+			return;
+		}
+		throw luan.exception("invalid type "+Luan.type(h)+" for metamethod __newindex");
+	}
+
+	public void rawPut(Object key,Object val) {
 		Integer iT = Luan.asInteger(key);
 		if( iT != null ) {
 			int i = iT - 1;
--- a/core/src/luan/impl/SetTableEntry.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/impl/SetTableEntry.java	Fri May 01 19:29:07 2015 -0600
@@ -25,29 +25,9 @@
 
 	private void newindex(LuanStateImpl luan,Object t,Object key,Object value) throws LuanException {
 		if( t instanceof LuanTable ) {
-			LuanTable table = (LuanTable)t;
-			Object h = table.getHandler("__newindex");
-			if( h==null || table.rawGet(key)!=null ) {
-				try {
-					table.put(key,value);
-				} catch(IllegalArgumentException e) {
-					throw luan.bit(se).exception(e);
-				} catch(UnsupportedOperationException e) {
-					throw luan.bit(se).exception(e);
-				}
-				return;
-			}
-			if( h instanceof LuanFunction ) {
-				LuanFunction fn = (LuanFunction)h;
-				luan.bit(se).call(fn,"__newindex",new Object[]{t,key,value});
-				return;
-			}
-			if( h instanceof LuanMeta ) {
-				LuanMeta meta = (LuanMeta)h;
-				meta.__newindex(luan,table,key,value);
-				return;
-			}
-			newindex(luan,h,key,value);
+			LuanTable tbl = (LuanTable)t;
+			tbl.put(luan,key,value);
+			return;
 		}
 		if( t != null && luan.currentEnvironment().hasJava() )
 			JavaLuan.__newindex(luan,t,key,value);
--- a/core/src/luan/impl/TableExpr.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/impl/TableExpr.java	Fri May 01 19:29:07 2015 -0600
@@ -30,16 +30,16 @@
 	@Override public Object eval(LuanStateImpl luan) throws LuanException {
 		LuanTable table = new LuanTable();
 		for( Field field : fields ) {
-			table.put( field.key.eval(luan), field.value.eval(luan) );
+			table.rawPut( field.key.eval(luan), field.value.eval(luan) );
 		}
 		Object obj = expressions.eval(luan);
 		if( obj instanceof Object[] ) {
 			Object[] a = (Object[])obj;
 			for( int i=0; i<a.length; i++ ) {
-				table.put( i+1, a[i] );
+				table.rawPut( i+1, a[i] );
 			}
 		} else {
-			table.put( 1, obj );
+			table.rawPut( 1, obj );
 		}
 		return table;
 	}
--- a/core/src/luan/modules/BasicLuan.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/BasicLuan.java	Fri May 01 19:29:07 2015 -0600
@@ -110,7 +110,7 @@
 	}
 
 	public static LuanTable raw_set(LuanTable table,Object index,Object value) {
-		table.put(index,value);
+		table.rawPut(index,value);
 		return table;
 	}
 
--- a/core/src/luan/modules/HtmlLuan.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/HtmlLuan.java	Fri May 01 19:29:07 2015 -0600
@@ -141,23 +141,23 @@
 
 	static LuanTable comment(String text) {
 		LuanTable tbl = new LuanTable();
-		tbl.put("type","comment");
-		tbl.put("text",text);
+		tbl.rawPut("type","comment");
+		tbl.rawPut("text",text);
 		return tbl;
 	}
 
 	static LuanTable cdata(String text) {
 		LuanTable tbl = new LuanTable();
-		tbl.put("type","cdata");
-		tbl.put("text",text);
+		tbl.rawPut("type","cdata");
+		tbl.rawPut("text",text);
 		return tbl;
 	}
 
 	static LuanTable textContainer(LuanTable tag,String text) {
 		LuanTable tbl = new LuanTable();
-		tbl.put("type","container");
-		tbl.put("tag",tag);
-		tbl.put("text",text);
+		tbl.rawPut("type","container");
+		tbl.rawPut("tag",tag);
+		tbl.rawPut("text",text);
 		return tbl;
 	}
 
@@ -171,12 +171,12 @@
 
 	static LuanTable parseTag(String text) {
 		LuanTable tbl = new LuanTable();
-		tbl.put("type","tag");
+		tbl.rawPut("type","tag");
 		if( text.endsWith("/") ) {
 			text = text.substring(0,text.length()-1);
-			tbl.put("is_empty",true);
+			tbl.rawPut("is_empty",true);
 		} else {
-			tbl.put("is_empty",false);
+			tbl.rawPut("is_empty",false);
 		}
 		int len = text.length();
 		int i = 0;
@@ -192,9 +192,9 @@
 			i2++;
 		}
 		String name = text.substring(i,i2).toLowerCase();
-		tbl.put("name",name);
+		tbl.rawPut("name",name);
 		LuanTable attributes = new LuanTable();
-		tbl.put("attributes",attributes);
+		tbl.rawPut("attributes",attributes);
 		i = i2;
 		while( i<len && Character.isWhitespace(text.charAt(i)) )  i++;
 		while( i<len ) {
@@ -213,11 +213,11 @@
 				if( attrValue.indexOf('<') != -1 || attrValue.indexOf('>') != -1 )
 					throw new BadTag("invalid attribute value: "+attrValue);
 				attrValue = unquote(attrValue);
-				attributes.put(attrName,attrValue);
+				attributes.rawPut(attrName,attrValue);
 				i = i2;
 				while( i<len && Character.isWhitespace(text.charAt(i)) )  i++;
 			} else {
-				attributes.put(attrName,true);
+				attributes.rawPut(attrName,true);
 			}
 		}
 		return tbl;
--- a/core/src/luan/modules/IoLuan.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/IoLuan.java	Fri May 01 19:29:07 2015 -0600
@@ -38,7 +38,7 @@
 public final class IoLuan {
 
 	private static void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException {
-		t.put( method, new LuanJavaFunction(IoLuan.class.getMethod(method,parameterTypes),null) );
+		t.rawPut( method, new LuanJavaFunction(IoLuan.class.getMethod(method,parameterTypes),null) );
 	}
 
 	public static String read_console_line(String prompt) throws IOException {
@@ -88,10 +88,10 @@
 	private static LuanTable writer(LuanWriter luanWriter) {
 		LuanTable writer = new LuanTable();
 		try {
-			writer.put( "write", new LuanJavaFunction(
+			writer.rawPut( "write", new LuanJavaFunction(
 				LuanWriter.class.getMethod( "write", LuanState.class, new Object[0].getClass() ), luanWriter
 			) );
-			writer.put( "close", new LuanJavaFunction(
+			writer.rawPut( "close", new LuanJavaFunction(
 				LuanWriter.class.getMethod( "close" ), luanWriter
 			) );
 		} catch(NoSuchMethodException e) {
@@ -104,10 +104,10 @@
 	public static LuanTable binaryWriter(final OutputStream out) {
 		LuanTable writer = new LuanTable();
 		try {
-			writer.put( "write", new LuanJavaFunction(
+			writer.rawPut( "write", new LuanJavaFunction(
 				OutputStream.class.getMethod( "write", new byte[0].getClass() ), out
 			) );
-			writer.put( "close", new LuanJavaFunction(
+			writer.rawPut( "close", new LuanJavaFunction(
 				OutputStream.class.getMethod( "close" ), out
 			) );
 		} catch(NoSuchMethodException e) {
@@ -206,22 +206,22 @@
 		public LuanTable table() {
 			LuanTable tbl = new LuanTable();
 			try {
-				tbl.put( "to_string", new LuanJavaFunction(
+				tbl.rawPut( "to_string", new LuanJavaFunction(
 					LuanIn.class.getMethod( "to_string" ), this
 				) );
-				tbl.put( "read_text", new LuanJavaFunction(
+				tbl.rawPut( "read_text", new LuanJavaFunction(
 					LuanIn.class.getMethod( "read_text" ), this
 				) );
-				tbl.put( "read_binary", new LuanJavaFunction(
+				tbl.rawPut( "read_binary", new LuanJavaFunction(
 					LuanIn.class.getMethod( "read_binary" ), this
 				) );
-				tbl.put( "read_lines", new LuanJavaFunction(
+				tbl.rawPut( "read_lines", new LuanJavaFunction(
 					LuanIn.class.getMethod( "read_lines" ), this
 				) );
-				tbl.put( "read_blocks", new LuanJavaFunction(
+				tbl.rawPut( "read_blocks", new LuanJavaFunction(
 					LuanIn.class.getMethod( "read_blocks", Integer.class ), this
 				) );
-				tbl.put( "exists", new LuanJavaFunction(
+				tbl.rawPut( "exists", new LuanJavaFunction(
 					LuanIn.class.getMethod( "exists" ), this
 				) );
 			} catch(NoSuchMethodException e) {
@@ -286,13 +286,13 @@
 		@Override public LuanTable table() {
 			LuanTable tbl = super.table();
 			try {
-				tbl.put( "write", new LuanJavaFunction(
+				tbl.rawPut( "write", new LuanJavaFunction(
 					LuanIO.class.getMethod( "write", LuanState.class, Object.class ), this
 				) );
-				tbl.put( "text_writer", new LuanJavaFunction(
+				tbl.rawPut( "text_writer", new LuanJavaFunction(
 					LuanIO.class.getMethod( "text_writer" ), this
 				) );
-				tbl.put( "binary_writer", new LuanJavaFunction(
+				tbl.rawPut( "binary_writer", new LuanJavaFunction(
 					LuanIO.class.getMethod( "binary_writer" ), this
 				) );
 			} catch(NoSuchMethodException e) {
@@ -373,7 +373,7 @@
 		@Override public LuanTable table() {
 			LuanTable tbl = super.table();
 			try {
-				tbl.put( "post", new LuanJavaFunction(
+				tbl.rawPut( "post", new LuanJavaFunction(
 					LuanUrl.class.getMethod( "post", String.class ), this
 				) );
 			} catch(NoSuchMethodException e) {
@@ -444,40 +444,40 @@
 		@Override public LuanTable table() {
 			LuanTable tbl = super.table();
 			try {
-				tbl.put( "name", new LuanJavaFunction(
+				tbl.rawPut( "name", new LuanJavaFunction(
 					File.class.getMethod( "getName" ), file
 				) );
-				tbl.put( "is_directory", new LuanJavaFunction(
+				tbl.rawPut( "is_directory", new LuanJavaFunction(
 					File.class.getMethod( "isDirectory" ), file
 				) );
-				tbl.put( "is_file", new LuanJavaFunction(
+				tbl.rawPut( "is_file", new LuanJavaFunction(
 					File.class.getMethod( "isFile" ), file
 				) );
-				tbl.put( "delete", new LuanJavaFunction(
+				tbl.rawPut( "delete", new LuanJavaFunction(
 					File.class.getMethod( "delete" ), file
 				) );
-				tbl.put( "mkdir", new LuanJavaFunction(
+				tbl.rawPut( "mkdir", new LuanJavaFunction(
 					File.class.getMethod( "mkdir" ), file
 				) );
-				tbl.put( "mkdirs", new LuanJavaFunction(
+				tbl.rawPut( "mkdirs", new LuanJavaFunction(
 					File.class.getMethod( "mkdirs" ), file
 				) );
-				tbl.put( "last_modified", new LuanJavaFunction(
+				tbl.rawPut( "last_modified", new LuanJavaFunction(
 					File.class.getMethod( "lastModified" ), file
 				) );
-				tbl.put( "child", new LuanJavaFunction(
+				tbl.rawPut( "child", new LuanJavaFunction(
 					LuanFile.class.getMethod( "child", LuanState.class, String.class ), this
 				) );
-				tbl.put( "children", new LuanJavaFunction(
+				tbl.rawPut( "children", new LuanJavaFunction(
 					LuanFile.class.getMethod( "children", LuanState.class ), this
 				) );
-				tbl.put( "parent", new LuanJavaFunction(
+				tbl.rawPut( "parent", new LuanJavaFunction(
 					LuanFile.class.getMethod( "parent", LuanState.class ), this
 				) );
-				tbl.put( "rename_to", new LuanJavaFunction(
+				tbl.rawPut( "rename_to", new LuanJavaFunction(
 					LuanFile.class.getMethod( "rename_to", String.class ), this
 				) );
-				tbl.put( "canonical", new LuanJavaFunction(
+				tbl.rawPut( "canonical", new LuanJavaFunction(
 					LuanFile.class.getMethod( "canonical", LuanState.class ), this
 				) );
 			} catch(NoSuchMethodException e) {
@@ -627,10 +627,10 @@
 		@Override public LuanTable table() {
 			LuanTable tbl = super.table();
 			try {
-				tbl.put( "Pickle_client", new LuanJavaFunction(
+				tbl.rawPut( "Pickle_client", new LuanJavaFunction(
 					LuanSocket.class.getMethod( "Pickle_client", LuanState.class ), this
 				) );
-				tbl.put( "run_pickle_server", new LuanJavaFunction(
+				tbl.rawPut( "run_pickle_server", new LuanJavaFunction(
 					LuanSocket.class.getMethod( "run_pickle_server", LuanState.class ), this
 				) );
 			} catch(NoSuchMethodException e) {
@@ -685,7 +685,7 @@
 	}
 
 	public static void setSecurity(LuanState luan,Security s) {
-		luan.registry().put(SECURITY_KEY,s);
+		luan.registry().rawPut(SECURITY_KEY,s);
 	}
 
 	private void IoLuan() {}  // never
--- a/core/src/luan/modules/JavaLuan.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/JavaLuan.java	Fri May 01 19:29:07 2015 -0600
@@ -471,7 +471,7 @@
 	}
 
 	public static void setSecurity(LuanState luan,Security s) {
-		luan.registry().put(SECURITY_KEY,s);
+		luan.registry().rawPut(SECURITY_KEY,s);
 	}
 
 }
--- a/core/src/luan/modules/PackageLuan.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/PackageLuan.java	Fri May 01 19:29:07 2015 -0600
@@ -27,7 +27,7 @@
 		LuanTable tbl = (LuanTable)luan.registry().rawGet("Package.loaded");
 		if( tbl == null ) {
 			tbl = new LuanTable();
-			luan.registry().put("Package.loaded",tbl);
+			luan.registry().rawPut("Package.loaded",tbl);
 		}
 		return tbl;
 	}
@@ -56,7 +56,7 @@
 				);
 				mod = result!=null ? result : env;
 			}
-			loaded.put(modName,mod);
+			loaded.rawPut(modName,mod);
 		}
 		return mod;
 	}
--- a/core/src/luan/modules/PickleClient.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/PickleClient.java	Fri May 01 19:29:07 2015 -0600
@@ -39,11 +39,11 @@
 	public Object call(Object... args) throws LuanException, IOException {
 		con.write(args);
 		Object[] result;
-		con.env.put("_reversed_pickle",_reversed_pickle);
+		con.env.rawPut("_reversed_pickle",_reversed_pickle);
 		try {
 			result = Luan.array(con.read());
 		} finally {
-			con.env.put("_reversed_pickle",null);
+			con.env.rawPut("_reversed_pickle",null);
 		}
 		boolean ok = (boolean)result[0];
 		if( ok ) {
@@ -66,13 +66,13 @@
 	LuanTable table() {
 		LuanTable tbl = new LuanTable();
 		try {
-			tbl.put( "pickle", new LuanJavaFunction(
+			tbl.rawPut( "pickle", new LuanJavaFunction(
 				PickleCon.class.getMethod( "pickle", Object.class ), con
 			) );
-			tbl.put( "call", new LuanJavaFunction(
+			tbl.rawPut( "call", new LuanJavaFunction(
 				PickleClient.class.getMethod( "call", new Object[0].getClass() ), this
 			) );
-			tbl.put( "close", new LuanJavaFunction(
+			tbl.rawPut( "close", new LuanJavaFunction(
 				PickleCon.class.getMethod( "close" ), con
 			) );
 		} catch(NoSuchMethodException e) {
--- a/core/src/luan/modules/PickleCon.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/PickleCon.java	Fri May 01 19:29:07 2015 -0600
@@ -56,14 +56,14 @@
 	}
 
 	public Object read() throws IOException, LuanException {
-		env.put("_read_binary",_read_binary);
+		env.rawPut("_read_binary",_read_binary);
 		try {
 			src = readString();
 			LuanFunction fn = BasicLuan.load(luan,src,"pickle-reader",env,false);
 			return luan.call(fn);
 		} finally {
-			env.put("_binaries",null);
-			env.put("_read_binary",null);
+			env.rawPut("_binaries",null);
+			env.rawPut("_read_binary",null);
 		}
 	}
 
--- a/core/src/luan/modules/PickleServer.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/PickleServer.java	Fri May 01 19:29:07 2015 -0600
@@ -73,10 +73,10 @@
 		Object old_unreverse_pickle = env.rawGet("_unreverse_pickle");
 		try {
 			try {
-				io.put("reverse_pickle", new LuanJavaFunction(
+				io.rawPut("reverse_pickle", new LuanJavaFunction(
 					PickleServer.class.getMethod( "reverse_pickle", LuanFunction.class ), this
 				) );
-				env.put("_unreverse_pickle", new LuanJavaFunction(
+				env.rawPut("_unreverse_pickle", new LuanJavaFunction(
 					PickleServer.class.getMethod( "_unreverse_pickle" ), this
 				) );
 			} catch(NoSuchMethodException e) {
@@ -100,8 +100,8 @@
 				}
 			}
 		} finally {
-			io.put("reverse_pickle",old_reverse_pickle);
-			env.put("_unreverse_pickle",old_unreverse_pickle);
+			io.rawPut("reverse_pickle",old_reverse_pickle);
+			env.rawPut("_unreverse_pickle",old_unreverse_pickle);
 		}
 	}
 
--- a/core/src/luan/modules/TableLuan.java	Fri May 01 18:44:20 2015 -0600
+++ b/core/src/luan/modules/TableLuan.java	Fri May 01 19:29:07 2015 -0600
@@ -90,10 +90,10 @@
 			} else if( !hasNull ) {
 				tbl.add(v);
 			} else {
-				tbl.put(i+1,v);
+				tbl.rawPut(i+1,v);
 			}
 		}
-		tbl.put( "n", args.length );
+		tbl.rawPut( "n", args.length );
 		return tbl;
 	}
 
--- a/lucene/src/luan/modules/lucene/LuceneDocument.java	Fri May 01 18:44:20 2015 -0600
+++ b/lucene/src/luan/modules/lucene/LuceneDocument.java	Fri May 01 19:29:07 2015 -0600
@@ -92,17 +92,17 @@
 				name = newName;
 			BytesRef br = ifld.binaryValue();
 			if( br != null ) {
-				table.put(name,br.bytes);
+				table.rawPut(name,br.bytes);
 				continue;
 			}
 			Number n = ifld.numericValue();
 			if( n != null ) {
-				table.put(name,n);
+				table.rawPut(name,n);
 				continue;
 			}
 			String s = ifld.stringValue();
 			if( s != null ) {
-				table.put(name,s);
+				table.rawPut(name,s);
 				continue;
 			}
 			throw luan.exception("invalid field type for "+ifld);
--- a/lucene/src/luan/modules/lucene/LuceneIndex.java	Fri May 01 18:44:20 2015 -0600
+++ b/lucene/src/luan/modules/lucene/LuceneIndex.java	Fri May 01 19:29:07 2015 -0600
@@ -132,8 +132,8 @@
 		if( id > idLim ) {
 			idLim += idBatch;
 			LuanTable doc = new LuanTable();
-			doc.put( "type", "next_id" );
-			doc.put( FLD_NEXT_ID, idLim );
+			doc.rawPut( "type", "next_id" );
+			doc.rawPut( FLD_NEXT_ID, idLim );
 			writer.updateDocument(newTerm("type","next_id"),toLucene(luan,doc));
 		}
 		return rtn;
--- a/lucene/src/luan/modules/lucene/LuceneSearcher.java	Fri May 01 18:44:20 2015 -0600
+++ b/lucene/src/luan/modules/lucene/LuceneSearcher.java	Fri May 01 19:29:07 2015 -0600
@@ -137,7 +137,7 @@
 	}
 
 	private void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException {
-		t.put( method, new LuanJavaFunction(LuceneSearcher.class.getMethod(method,parameterTypes),this) );
+		t.rawPut( method, new LuanJavaFunction(LuceneSearcher.class.getMethod(method,parameterTypes),this) );
 	}
 
 	LuanTable table() {
--- a/lucene/src/luan/modules/lucene/LuceneWriter.java	Fri May 01 18:44:20 2015 -0600
+++ b/lucene/src/luan/modules/lucene/LuceneWriter.java	Fri May 01 19:29:07 2015 -0600
@@ -63,7 +63,7 @@
 		String id = (String)doc.get(luan,"id");
 		if( id == null ) {
 			id = nextId(luan);
-			doc.put("id",id);
+			doc.put(luan,"id",id);
 			addDocument(luan,doc);
 		} else {
 			updateDocument(luan,index.newTerm("id",id),doc);
@@ -73,7 +73,7 @@
 	// luan
 
 	private void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException {
-		t.put( method, new LuanJavaFunction(LuceneWriter.class.getMethod(method,parameterTypes),this) );
+		t.rawPut( method, new LuanJavaFunction(LuceneWriter.class.getMethod(method,parameterTypes),this) );
 	}
 
 	LuanTable table() {
--- a/web/src/luan/modules/web/HttpServicer.java	Fri May 01 18:44:20 2015 -0600
+++ b/web/src/luan/modules/web/HttpServicer.java	Fri May 01 19:29:07 2015 -0600
@@ -74,9 +74,9 @@
 		LuanTable module = (LuanTable)PackageLuan.require(luan,"luan:web/Http");
 		HttpServicer lib = new HttpServicer(request,response);
 		try {
-			module.put( "request", lib.requestTable() );
-			module.put( "response", lib.responseTable() );
-			module.put( "session", lib.sessionTable() );
+			module.put( luan, "request", lib.requestTable() );
+			module.put( luan, "response", lib.responseTable() );
+			module.put( luan, "session", lib.sessionTable() );
 /*
 			module.put( "write", new LuanJavaFunction(
 				HttpServicer.class.getMethod( "text_write", LuanState.class, new Object[0].getClass() ), lib
@@ -119,7 +119,7 @@
 	private LuanTable requestTable() throws NoSuchMethodException {
 		LuanTable tbl = LuanPropertyMeta.INSTANCE.newTable();
 		LuanTable getters = LuanPropertyMeta.INSTANCE.getters(tbl);
-		tbl.put("java",request);
+		tbl.rawPut("java",request);
 		LuanTable parameters = new NameMeta() {
 
 			@Override Object get(String name) {
@@ -135,7 +135,7 @@
 			}
 
 		}.newTable();
-		tbl.put( "parameters", parameters );
+		tbl.rawPut( "parameters", parameters );
 		add( tbl, "get_parameter_values", String.class );
 		LuanTable headers = new NameMeta() {
 
@@ -152,23 +152,23 @@
 			}
 
 		}.newTable();
-		tbl.put( "headers", headers );
-		getters.put( "method", new LuanJavaFunction(
+		tbl.rawPut( "headers", headers );
+		getters.rawPut( "method", new LuanJavaFunction(
 			HttpServletRequest.class.getMethod( "getMethod" ), request
 		) );
-		getters.put( "path", new LuanJavaFunction(
+		getters.rawPut( "path", new LuanJavaFunction(
 			HttpServletRequest.class.getMethod( "getRequestURI" ), request
 		) );
-		getters.put( "server_name", new LuanJavaFunction(
+		getters.rawPut( "server_name", new LuanJavaFunction(
 			HttpServletRequest.class.getMethod( "getServerName" ), request
 		) );
-		getters.put( "url", new LuanJavaFunction(
+		getters.rawPut( "url", new LuanJavaFunction(
 			HttpServicer.class.getMethod( "getURL" ), this
 		) );
-		getters.put( "query_string", new LuanJavaFunction(
+		getters.rawPut( "query_string", new LuanJavaFunction(
 			HttpServicer.class.getMethod( "getQueryString" ), this
 		) );
-		getters.put( "remote_address", new LuanJavaFunction(
+		getters.rawPut( "remote_address", new LuanJavaFunction(
 			HttpServletRequest.class.getMethod( "getRemoteAddr" ), request
 		) );
 		LuanTable cookies = new LuanMeta() {
@@ -202,7 +202,7 @@
 			}
 
 		}.newTable();
-		tbl.put( "cookies", cookies );
+		tbl.rawPut( "cookies", cookies );
 
 		String contentType = request.getContentType();
 		if( contentType!=null && contentType.startsWith("multipart/form-data") ) {
@@ -221,9 +221,9 @@
 						value = new String(part.getBytes());
 					} else {
 						LuanTable partTbl = LuanPropertyMeta.INSTANCE.newTable();
-						partTbl.put("filename",filename);
-						partTbl.put("content_type",part.getContentType());
-						LuanPropertyMeta.INSTANCE.getters(partTbl).put( "content", new LuanFunction() {
+						partTbl.rawPut("filename",filename);
+						partTbl.rawPut("content_type",part.getContentType());
+						LuanPropertyMeta.INSTANCE.getters(partTbl).rawPut( "content", new LuanFunction() {
 							@Override public Object call(LuanState luan,Object[] args) throws LuanException {
 								try {
 									InputStream in = part.getInputStream();
@@ -237,7 +237,7 @@
 						} );
 						value = partTbl;
 					}
-					parameters.put(name,value);
+					parameters.rawPut(name,value);
 					Object old = map.get(name);
 					if( old == null ) {
 						map.put(name,value);
@@ -251,8 +251,8 @@
 						map.put(name,new Object[]{old,value});
 					}
 				}
-				tbl.put( "parameters", parameters );
-				tbl.put( "get_parameter_values", new LuanFunction() {
+				tbl.rawPut( "parameters", parameters );
+				tbl.rawPut( "get_parameter_values", new LuanFunction() {
 					@Override public Object call(LuanState luan,Object[] args) throws LuanException {
 						return args.length==0 ? null : map.get(args[0]);
 					}
@@ -271,7 +271,7 @@
 		LuanTable tbl = LuanPropertyMeta.INSTANCE.newTable();
 		LuanTable getters = LuanPropertyMeta.INSTANCE.getters(tbl);
 		LuanTable setters = LuanPropertyMeta.INSTANCE.setters(tbl);
-		tbl.put("java",response);
+		tbl.rawPut("java",response);
 		add( tbl, "send_redirect", String.class );
 		add( tbl, "send_error", Integer.TYPE, String.class );
 		LuanTable headers = new NameMeta() {
@@ -309,26 +309,26 @@
 			}
 
 		}.newTable();
-		tbl.put( "headers", headers );
-		getters.put( "content_type", new LuanJavaFunction(
+		tbl.rawPut( "headers", headers );
+		getters.rawPut( "content_type", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod( "getContentType" ), response
 		) );
-		setters.put( "content_type", new LuanJavaFunction(
+		setters.rawPut( "content_type", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod( "setContentType", String.class ), response
 		) );
-		getters.put( "character_encoding", new LuanJavaFunction(
+		getters.rawPut( "character_encoding", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod( "getCharacterEncoding" ), response
 		) );
-		setters.put( "character_encoding", new LuanJavaFunction(
+		setters.rawPut( "character_encoding", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod( "setCharacterEncoding", String.class ), response
 		) );
 		add( tbl, "text_writer" );
 		add( tbl, "set_cookie", String.class, String.class, Boolean.TYPE, String.class );
 		add( tbl, "remove_cookie", String.class, String.class );
-		getters.put( "status", new LuanJavaFunction(
+		getters.rawPut( "status", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod( "getStatus" ), response
 		) );
-		setters.put( "status", new LuanJavaFunction(
+		setters.rawPut( "status", new LuanJavaFunction(
 			HttpServletResponse.class.getMethod( "setStatus", Integer.TYPE ), response
 		) );
 		return tbl;
@@ -362,12 +362,12 @@
 			}
 
 		}.newTable();
-		tbl.put( "attributes", attributes );
+		tbl.rawPut( "attributes", attributes );
 		return tbl;
 	}
 
 	private void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException {
-		t.put( method, new LuanJavaFunction(HttpServicer.class.getMethod(method,parameterTypes),this) );
+		t.rawPut( method, new LuanJavaFunction(HttpServicer.class.getMethod(method,parameterTypes),this) );
 	}
 /*
 	public void text_write(LuanState luan,Object... args) throws LuanException, IOException {