Mercurial Hosting > luan
comparison core/src/luan/modules/StringLuan.java @ 289:ae7ae2755b48
improve Mail;
add String.concat();
git-svn-id: https://luan-java.googlecode.com/svn/trunk@290 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Mon, 08 Dec 2014 07:45:40 +0000 |
parents | 82a3ebcfbafa |
children | 899253043270 |
comparison
equal
deleted
inserted
replaced
288:c4ed33e95889 | 289:ae7ae2755b48 |
---|---|
18 LuanTable module = Luan.newTable(); | 18 LuanTable module = Luan.newTable(); |
19 try { | 19 try { |
20 add( module, "to_binary", String.class ); | 20 add( module, "to_binary", String.class ); |
21 module.put( "byte", new LuanJavaFunction(StringLuan.class.getMethod( "byte_", String.class ),null) ); | 21 module.put( "byte", new LuanJavaFunction(StringLuan.class.getMethod( "byte_", String.class ),null) ); |
22 module.put( "char", new LuanJavaFunction(StringLuan.class.getMethod( "char_", new int[0].getClass() ),null) ); | 22 module.put( "char", new LuanJavaFunction(StringLuan.class.getMethod( "char_", new int[0].getClass() ),null) ); |
23 add( module, "concat", LuanState.class, new Object[0].getClass() ); | |
23 add( module, "find", String.class, String.class, Integer.class, Boolean.class ); | 24 add( module, "find", String.class, String.class, Integer.class, Boolean.class ); |
24 add( module, "format", String.class, new Object[0].getClass() ); | 25 add( module, "format", String.class, new Object[0].getClass() ); |
25 add( module, "gmatch", LuanState.class, String.class, String.class ); | 26 add( module, "gmatch", LuanState.class, String.class, String.class ); |
26 add( module, "gsub", LuanState.class, String.class, String.class, Object.class, Integer.class ); | 27 add( module, "gsub", LuanState.class, String.class, String.class, Object.class, Integer.class ); |
27 add( module, "len", LuanState.class, String.class ); | 28 add( module, "len", LuanState.class, String.class ); |
254 // note - String.format() is too stupid to convert between ints and floats. | 255 // note - String.format() is too stupid to convert between ints and floats. |
255 public static String format(String format,Object... args) { | 256 public static String format(String format,Object... args) { |
256 return String.format(format,args); | 257 return String.format(format,args); |
257 } | 258 } |
258 | 259 |
260 public static String concat(LuanState luan,Object... args) throws LuanException { | |
261 StringBuilder sb = new StringBuilder(); | |
262 for( Object arg : args ) { | |
263 sb.append( luan.toString(arg) ); | |
264 } | |
265 return sb.toString(); | |
266 } | |
267 | |
259 } | 268 } |