comparison src/luan/interp/LenExpr.java @ 114:c599206448b9

minor git-svn-id: https://luan-java.googlecode.com/svn/trunk@115 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 26 May 2014 05:39:54 +0000
parents f5af13062b10
children
comparison
equal deleted inserted replaced
113:8c706d6eb5dc 114:c599206448b9
18 Object o = op.eval(luan); 18 Object o = op.eval(luan);
19 if( o instanceof String ) { 19 if( o instanceof String ) {
20 String s = (String)o; 20 String s = (String)o;
21 return s.length(); 21 return s.length();
22 } 22 }
23 if( o instanceof byte[] ) {
24 byte[] a = (byte[])o;
25 return a.length;
26 }
23 LuanBit bit = luan.bit(se); 27 LuanBit bit = luan.bit(se);
24 LuanFunction fn = bit.getHandlerFunction("__len",o); 28 LuanFunction fn = bit.getHandlerFunction("__len",o);
25 if( fn != null ) 29 if( fn != null )
26 return Luan.first(bit.call(fn,"__len",new Object[]{o})); 30 return Luan.first(bit.call(fn,"__len",new Object[]{o}));
27 if( o instanceof LuanTable ) { 31 if( o instanceof LuanTable ) {