comparison src/luan/Luan.java @ 113:8c706d6eb5dc

add binary type git-svn-id: https://luan-java.googlecode.com/svn/trunk@114 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 26 May 2014 05:27:26 +0000
parents 2428ecfed375
children b585d0915621
comparison
equal deleted inserted replaced
112:f5af13062b10 113:8c706d6eb5dc
26 return "number"; 26 return "number";
27 if( obj instanceof LuanTable ) 27 if( obj instanceof LuanTable )
28 return "table"; 28 return "table";
29 if( obj instanceof LuanFunction ) 29 if( obj instanceof LuanFunction )
30 return "function"; 30 return "function";
31 if( obj instanceof byte[] )
32 return "binary";
31 return "userdata"; 33 return "userdata";
32 } 34 }
33 35
34 public static boolean toBoolean(Object obj) { 36 public static boolean toBoolean(Object obj) {
35 return obj != null && !Boolean.FALSE.equals(obj); 37 return obj != null && !Boolean.FALSE.equals(obj);
96 return Luan.toString((Number)obj); 98 return Luan.toString((Number)obj);
97 if( obj instanceof LuanException ) { 99 if( obj instanceof LuanException ) {
98 LuanException le = (LuanException)obj; 100 LuanException le = (LuanException)obj;
99 return le.getMessage(); 101 return le.getMessage();
100 } 102 }
103 if( obj instanceof byte[] )
104 return "binary: " + Integer.toHexString(obj.hashCode());
101 return obj.toString(); 105 return obj.toString();
102 } 106 }
103 107
104 public static String stringEncode(String s) { 108 public static String stringEncode(String s) {
105 s = s.replace("\\","\\\\"); 109 s = s.replace("\\","\\\\");