diff src/luan/lib/StringLib.java @ 88:6ca02b188dba

add LuanBit to clean up code; add repr(); git-svn-id: https://luan-java.googlecode.com/svn/trunk@89 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Wed, 27 Feb 2013 23:50:32 +0000
parents eaf37cfa30c2
children b1e87f1bcc13
line wrap: on
line diff
--- a/src/luan/lib/StringLib.java	Wed Feb 27 19:42:09 2013 +0000
+++ b/src/luan/lib/StringLib.java	Wed Feb 27 23:50:32 2013 +0000
@@ -171,7 +171,7 @@
 				if( Luan.toBoolean(val) ) {
 					String replacement = Luan.asString(val);
 					if( replacement==null )
-						throw new LuanException( luan, LuanElement.JAVA, "invalid replacement value (a "+Luan.type(val)+")" );
+						throw luan.JAVA.exception( "invalid replacement value (a "+Luan.type(val)+")" );
 					m.appendReplacement(sb,replacement);
 				}
 				i++;
@@ -194,11 +194,11 @@
 						args[j] = m.group(j);
 					}
 				}
-				Object val = Luan.first( luan.call(fn,LuanElement.JAVA,"repl-arg",args) );
+				Object val = Luan.first( luan.JAVA.call(fn,"repl-arg",args) );
 				if( Luan.toBoolean(val) ) {
 					String replacement = Luan.asString(val);
 					if( replacement==null )
-						throw new LuanException( luan, LuanElement.JAVA, "invalid replacement value (a "+Luan.type(val)+")" );
+						throw luan.JAVA.exception( "invalid replacement value (a "+Luan.type(val)+")" );
 					m.appendReplacement(sb,replacement);
 				}
 				i++;
@@ -206,7 +206,7 @@
 			m.appendTail(sb);
 			return new Object[]{ sb.toString(), i };
 		}
-		throw new LuanException( luan, LuanElement.JAVA, "bad argument #3 to 'gsub' (string/function/table expected)" );
+		throw luan.JAVA.exception( "bad argument #3 to 'gsub' (string/function/table expected)" );
 	}
 
 	// note - String.format() is too stupid to convert between ints and floats.