Mercurial Hosting > luan
comparison core/src/luan/impl/LeExpr.java @ 647:8e8c30b72e9b
move methods from LuanState to Luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 20:39:14 -0600 |
parents | cdc70de628b5 |
children |
comparison
equal
deleted
inserted
replaced
646:cdc70de628b5 | 647:8e8c30b72e9b |
---|---|
26 if( o1 instanceof String && o2 instanceof String ) { | 26 if( o1 instanceof String && o2 instanceof String ) { |
27 String s1 = (String)o1; | 27 String s1 = (String)o1; |
28 String s2 = (String)o2; | 28 String s2 = (String)o2; |
29 return s1.compareTo(s2) <= 0; | 29 return s1.compareTo(s2) <= 0; |
30 } | 30 } |
31 LuanFunction fn = luan.getBinHandler("__le",o1,o2); | 31 LuanFunction fn = Luan.getBinHandler("__le",o1,o2); |
32 if( fn != null ) | 32 if( fn != null ) |
33 return luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o1,o2})) ); | 33 return Luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o1,o2})) ); |
34 fn = luan.getBinHandler("__lt",o1,o2); | 34 fn = Luan.getBinHandler("__lt",o1,o2); |
35 if( fn != null ) | 35 if( fn != null ) |
36 return !luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o2,o1})) ); | 36 return !Luan.checkBoolean( Luan.first(fn.call(luan,new Object[]{o2,o1})) ); |
37 throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); | 37 throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); |
38 } | 38 } |
39 } | 39 } |