Mercurial Hosting > luan
diff src/luan/lib/StringLib.java @ 112:f5af13062b10
fix previous rev
git-svn-id: https://luan-java.googlecode.com/svn/trunk@113 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 23 May 2014 22:52:39 +0000 |
parents | 3c404a296995 |
children | 8c706d6eb5dc |
line wrap: on
line diff
--- a/src/luan/lib/StringLib.java Fri May 23 20:40:05 2014 +0000 +++ b/src/luan/lib/StringLib.java Fri May 23 22:52:39 2014 +0000 @@ -16,7 +16,7 @@ public static final String NAME = "String"; public static final LuanFunction LOADER = new LuanFunction() { - @Override public Object[] call(LuanState luan,Object[] args) { + @Override public Object call(LuanState luan,Object[] args) { LuanTable module = new LuanTable(); try { module.put( "byte", new LuanJavaFunction(StringLib.class.getMethod("byte_",String.class,Integer.class,Integer.class),null) ); @@ -35,7 +35,7 @@ } catch(NoSuchMethodException e) { throw new RuntimeException(e); } - return new Object[]{module}; + return module; } }; @@ -131,12 +131,12 @@ public static LuanFunction gmatch(String s,String pattern) { final Matcher m = Pattern.compile(pattern).matcher(s); return new LuanFunction() { - public Object[] call(LuanState luan,Object[] args) { + @Override public Object call(LuanState luan,Object[] args) { if( !m.find() ) - return LuanFunction.EMPTY; + return null; final int n = m.groupCount(); if( n == 0 ) - return new String[]{m.group()}; + return m.group(); String[] rtn = new String[n]; for( int i=0; i<n; i++ ) { rtn[i] = m.group(i);