changeset 428:df95199ca4c0

rename __newindex to __new_index
author Franklin Schmidt <fschmidt@gmail.com>
date Sat, 02 May 2015 20:10:31 -0600
parents dae264ad6a7b
children e3a6d9dbd694
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/modules/JavaLuan.java lucene/src/luan/modules/lucene/FieldTable.java web/src/luan/modules/web/HttpServicer.java website/src/manual.html.luan
diffstat 8 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/core/src/luan/LuanMeta.java	Fri May 01 19:29:07 2015 -0600
+++ b/core/src/luan/LuanMeta.java	Sat May 02 20:10:31 2015 -0600
@@ -41,7 +41,7 @@
 		return false;
 	}
 
-	public void __newindex(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException {
+	public void __new_index(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException {
 		throw new UnsupportedOperationException();
 	}
 
@@ -57,7 +57,7 @@
 		mt.rawPut( "__pairs", this );
 		mt.rawPut( "__tostring", this );
 		if( canNewindex() )
-			mt.rawPut( "__newindex", this );
+			mt.rawPut( "__new_index", this );
 		return mt;
 	}
 
--- a/core/src/luan/LuanPropertyMeta.java	Fri May 01 19:29:07 2015 -0600
+++ b/core/src/luan/LuanPropertyMeta.java	Sat May 02 20:10:31 2015 -0600
@@ -52,7 +52,7 @@
 		return true;
 	}
 
-	@Override public void __newindex(LuanState luan,LuanTable tbl,Object key,Object value) throws LuanException {
+	@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+"'");
--- a/core/src/luan/LuanTable.java	Fri May 01 19:29:07 2015 -0600
+++ b/core/src/luan/LuanTable.java	Sat May 02 20:10:31 2015 -0600
@@ -127,19 +127,19 @@
 	}
 
 	public void put(LuanState luan,Object key,Object value) throws LuanException {
-		Object h = getHandler("__newindex");
+		Object h = getHandler("__new_index");
 		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});
+			luan.call(fn,"__new_index",new Object[]{this,key,value});
 			return;
 		}
 		if( h instanceof LuanMeta ) {
 			LuanMeta meta = (LuanMeta)h;
-			meta.__newindex(luan,this,key,value);
+			meta.__new_index(luan,this,key,value);
 			return;
 		}
 		if( h instanceof LuanTable ) {
@@ -147,7 +147,7 @@
 			tbl.put(luan,key,value);
 			return;
 		}
-		throw luan.exception("invalid type "+Luan.type(h)+" for metamethod __newindex");
+		throw luan.exception("invalid type "+Luan.type(h)+" for metamethod __new_index");
 	}
 
 	public void rawPut(Object key,Object val) {
--- a/core/src/luan/impl/SetTableEntry.java	Fri May 01 19:29:07 2015 -0600
+++ b/core/src/luan/impl/SetTableEntry.java	Sat May 02 20:10:31 2015 -0600
@@ -20,17 +20,17 @@
 	}
 
 	@Override public void set(LuanStateImpl luan,Object value) throws LuanException {
-		newindex( luan, tableExpr.eval(luan), keyExpr.eval(luan), value );
+		newIndex( luan, tableExpr.eval(luan), keyExpr.eval(luan), value );
 	}
 
-	private void newindex(LuanStateImpl luan,Object t,Object key,Object value) throws LuanException {
+	private void newIndex(LuanStateImpl luan,Object t,Object key,Object value) throws LuanException {
 		if( t instanceof LuanTable ) {
 			LuanTable tbl = (LuanTable)t;
 			tbl.put(luan,key,value);
 			return;
 		}
 		if( t != null && luan.currentEnvironment().hasJava() )
-			JavaLuan.__newindex(luan,t,key,value);
+			JavaLuan.__new_index(luan,t,key,value);
 		else
 			throw luan.bit(se).exception( "attempt to index '"+tableExpr.se().text()+"' (a " + Luan.type(t) + " value)" );
 	}
--- a/core/src/luan/modules/JavaLuan.java	Fri May 01 19:29:07 2015 -0600
+++ b/core/src/luan/modules/JavaLuan.java	Sat May 02 20:10:31 2015 -0600
@@ -142,7 +142,7 @@
 		}
 	}
 
-	public static void __newindex(LuanState luan,Object obj,Object key,Object value) throws LuanException {
+	public static void __new_index(LuanState luan,Object obj,Object key,Object value) throws LuanException {
 		checkJava(luan);
 		if( obj instanceof Static ) {
 			if( key instanceof String ) {
--- a/lucene/src/luan/modules/lucene/FieldTable.java	Fri May 01 19:29:07 2015 -0600
+++ b/lucene/src/luan/modules/lucene/FieldTable.java	Sat May 02 20:10:31 2015 -0600
@@ -22,7 +22,7 @@
 		return true;
 	}
 
-	@Override public void __newindex(LuanState luan,LuanTable tbl,Object key,Object value) {
+	@Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object value) {
 		put(key,value);
 	}
 
--- a/web/src/luan/modules/web/HttpServicer.java	Fri May 01 19:29:07 2015 -0600
+++ b/web/src/luan/modules/web/HttpServicer.java	Sat May 02 20:10:31 2015 -0600
@@ -288,7 +288,7 @@
 				return true;
 			}
 
-			@Override public void __newindex(LuanState luan,LuanTable tbl,Object key,Object val) {
+			@Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object val) {
 				if( !(key instanceof String) )
 					throw new IllegalArgumentException("key must be string for headers table");
 				String name = (String)key;
@@ -350,7 +350,7 @@
 				return true;
 			}
 
-			@Override public void __newindex(LuanState luan,LuanTable tbl,Object key,Object val) {
+			@Override public void __new_index(LuanState luan,LuanTable tbl,Object key,Object val) {
 				if( !(key instanceof String) )
 					throw new IllegalArgumentException("key must be string for session attributes table");
 				String name = (String)key;
--- a/website/src/manual.html.luan	Fri May 01 19:29:07 2015 -0600
+++ b/website/src/manual.html.luan	Sat May 02 20:10:31 2015 -0600
@@ -457,7 +457,7 @@
 and therefore can trigger another metamethod.)
 </li>
 
-<li><b>"newindex": </b>
+<li><b>"new_index": </b>
 The indexing assignment <tt>table[key] = value</tt>.
 
 Like the index event,
@@ -478,7 +478,7 @@
 
 
 <p>
-Whenever there is a "newindex" metamethod,
+Whenever there is a "new_index" metamethod,
 Luan does not perform the primitive assignment.
 (If necessary,
 the metamethod itself can call <a href="#pdf-rawset"><tt>raw_set</tt></a>