comparison core/src/luan/impl/LuanStateImpl.java @ 646:cdc70de628b5

simplify LuanException
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 29 Mar 2016 19:58:39 -0600
parents 859c0dedc8b6
children 8e8c30b72e9b
comparison
equal deleted inserted replaced
645:859c0dedc8b6 646:cdc70de628b5
130 return s1.compareTo(s2) < 0; 130 return s1.compareTo(s2) < 0;
131 } 131 }
132 LuanFunction fn = getBinHandler("__lt",o1,o2); 132 LuanFunction fn = getBinHandler("__lt",o1,o2);
133 if( fn != null ) 133 if( fn != null )
134 return checkBoolean( Luan.first(fn.call(this,new Object[]{o1,o2})) ); 134 return checkBoolean( Luan.first(fn.call(this,new Object[]{o1,o2})) );
135 throw new LuanException(this, "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) ); 135 throw new LuanException( "attempt to compare " + Luan.type(o1) + " with " + Luan.type(o2) );
136 } 136 }
137 137
138 LuanFunction getBinHandler(String op,Object o1,Object o2) throws LuanException { 138 LuanFunction getBinHandler(String op,Object o1,Object o2) throws LuanException {
139 if( o1 instanceof LuanTable ) { 139 if( o1 instanceof LuanTable ) {
140 LuanFunction f1 = getHandlerFunction(op,(LuanTable)o1); 140 LuanFunction f1 = getHandlerFunction(op,(LuanTable)o1);