comparison src/luan/interp/LenExpr.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 6ca02b188dba
children c599206448b9
comparison
equal deleted inserted replaced
111:2428ecfed375 112:f5af13062b10
21 return s.length(); 21 return s.length();
22 } 22 }
23 LuanBit bit = luan.bit(se); 23 LuanBit bit = luan.bit(se);
24 LuanFunction fn = bit.getHandlerFunction("__len",o); 24 LuanFunction fn = bit.getHandlerFunction("__len",o);
25 if( fn != null ) 25 if( fn != null )
26 return Luan.first(bit.call(fn,"__len",o)); 26 return Luan.first(bit.call(fn,"__len",new Object[]{o}));
27 if( o instanceof LuanTable ) { 27 if( o instanceof LuanTable ) {
28 LuanTable t = (LuanTable)o; 28 LuanTable t = (LuanTable)o;
29 return t.length(); 29 return t.length();
30 } 30 }
31 throw bit.exception( "attempt to get length of a " + Luan.type(o) + " value" ); 31 throw bit.exception( "attempt to get length of a " + Luan.type(o) + " value" );