changeset 757:e1dfeddfbc7b

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 18 Jul 2016 20:18:02 -0600
parents 9092e52f94eb
children c29d11d675fd
files core/src/luan/modules/String.luan core/src/luan/modules/StringLuan.java lucene/src/luan/modules/lucene/Lucene.luan
diffstat 3 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
diff -r 9092e52f94eb -r e1dfeddfbc7b core/src/luan/modules/String.luan
--- a/core/src/luan/modules/String.luan	Mon Jul 18 05:14:19 2016 -0600
+++ b/core/src/luan/modules/String.luan	Mon Jul 18 20:18:02 2016 -0600
@@ -17,6 +17,7 @@
 M.matches = StringLuan.matches
 M.rep = StringLuan.rep
 M.reverse = StringLuan.reverse
+M.split = StringLuan.split
 M.sub = StringLuan.sub
 M.to_binary = StringLuan.to_binary
 M.to_number = StringLuan.to_number
diff -r 9092e52f94eb -r e1dfeddfbc7b core/src/luan/modules/StringLuan.java
--- a/core/src/luan/modules/StringLuan.java	Mon Jul 18 05:14:19 2016 -0600
+++ b/core/src/luan/modules/StringLuan.java	Mon Jul 18 20:18:02 2016 -0600
@@ -1,5 +1,6 @@
 package luan.modules;
 
+import java.util.Arrays;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 import luan.Luan;
@@ -238,4 +239,9 @@
 		return Pattern.compile(pattern).matcher(s).find();
 	}
 
+	public static LuanTable split(String s,String pattern) throws LuanException {
+		Utils.checkNotNull(s);
+		return new LuanTable(Arrays.asList(s.split(pattern)));
+	}
+
 }
diff -r 9092e52f94eb -r e1dfeddfbc7b lucene/src/luan/modules/lucene/Lucene.luan
--- a/lucene/src/luan/modules/lucene/Lucene.luan	Mon Jul 18 05:14:19 2016 -0600
+++ b/lucene/src/luan/modules/lucene/Lucene.luan	Mon Jul 18 20:18:02 2016 -0600
@@ -132,18 +132,14 @@
 	if Rpc.functions.backup == nil then
 
 		function Rpc.functions.lucene_backup(password)
-			if Io.password ~= password then
-				error "wrong password"
-			end
+			Io.password == password or error "wrong password"
 			local zip_file = uri("file:"..index.dir).parent().child("backup.zip")
 			index.zip(zip_file)
 			return zip_file
 		end
 
 		function Rpc.functions.lucene_restore(password,zip_file)
-			if Io.password ~= password then
-				error "wrong password"
-			end
+			Io.password == password or error "wrong password"
 			index.restore(zip_file)
 		end