comparison src/luan/LuanJavaFunction.java @ 1121:4cf541886663

check for too many arguments to java fns
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 11 Aug 2017 17:57:52 -0600
parents e8fc6712b468
children aa8517d7c065
comparison
equal deleted inserted replaced
1120:e8fc6712b468 1121:4cf541886663
158 rtn = new Object[n]; 158 rtn = new Object[n];
159 if( takesLuaState ) { 159 if( takesLuaState ) {
160 rtn[start++] = luan; 160 rtn[start++] = luan;
161 } 161 }
162 n = argConverters.length; 162 n = argConverters.length;
163 if( varArgCls != null ) { 163 if( varArgCls == null ) {
164 for( int i=n; i<args.length; i++ ) {
165 if( args[i] != null )
166 throw new LuanException("too many arguments");
167 }
168 } else {
164 n--; 169 n--;
165 if( args.length < argConverters.length ) { 170 if( args.length < argConverters.length ) {
166 rtn[rtn.length-1] = Array.newInstance(varArgCls,0); 171 rtn[rtn.length-1] = Array.newInstance(varArgCls,0);
167 } else { 172 } else {
168 int len = args.length - n; 173 int len = args.length - n;