comparison src/luan/LuanJavaFunction.java @ 1356:71f067287642

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 18 Apr 2019 00:34:04 -0600
parents e0cf0d108a77
children 8fbcc4747091
comparison
equal deleted inserted replaced
1355:b84f60ebe196 1356:71f067287642
122 expected = fixType(paramType.getSimpleName()); 122 expected = fixType(paramType.getSimpleName());
123 if( arg==null ) { 123 if( arg==null ) {
124 if( paramType.isPrimitive() ) 124 if( paramType.isPrimitive() )
125 throw new LuanException("bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)"); 125 throw new LuanException("bad argument #"+(i+1-start)+" ("+expected+" expected, got nil)");
126 } else { 126 } else {
127 String got = fixType(arg.getClass().getSimpleName()); 127 String got;
128 if( arg instanceof LuanFunction ) {
129 got = "function";
130 } else {
131 got = fixType(arg.getClass().getSimpleName());
132 if( got.equals("") )
133 got = arg.getClass().toString();
134 }
128 throw new LuanException("bad argument #"+(i+1-start)+" ("+expected+" expected, got "+got+")"); 135 throw new LuanException("bad argument #"+(i+1-start)+" ("+expected+" expected, got "+got+")");
129 } 136 }
130 } 137 }
131 } 138 }
132 } 139 }
140 return "table"; 147 return "table";
141 if( type.equals("Boolean") ) 148 if( type.equals("Boolean") )
142 return "boolean"; 149 return "boolean";
143 if( type.equals("String") ) 150 if( type.equals("String") )
144 return "string"; 151 return "string";
145 if( type.equals("Closure") ) 152 if( type.equals("LuanClosure") )
146 return "function"; 153 return "function";
147 if( type.equals("LuanJavaFunction") ) 154 if( type.equals("LuanJavaFunction") )
148 return "function"; 155 return "function";
149 return type; 156 return type;
150 } 157 }