comparison core/src/luan/modules/BasicLuan.java @ 447:0bd42e774c50

add assert_binary; improve wrong type messages;
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 04 May 2015 17:19:43 -0600
parents bbad2d06f728
children 8b2db645b9b2
comparison
equal deleted inserted replaced
446:bbad2d06f728 447:0bd42e774c50
151 151
152 public static long assert_long(LuanState luan,long v) throws LuanException { 152 public static long assert_long(LuanState luan,long v) throws LuanException {
153 return v; 153 return v;
154 } 154 }
155 155
156 @LuanMethod public static byte[] assert_binary(LuanState luan,byte[] v) throws LuanException {
157 Utils.checkNotNull(luan,v);
158 return v;
159 }
160
156 public static LuanFunction range(LuanState luan,final double from,final double to,Double stepV) throws LuanException { 161 public static LuanFunction range(LuanState luan,final double from,final double to,Double stepV) throws LuanException {
157 final double step = stepV==null ? 1.0 : stepV; 162 final double step = stepV==null ? 1.0 : stepV;
158 if( step == 0.0 ) 163 if( step == 0.0 )
159 throw luan.exception("bad argument #3 (step may not be zero)"); 164 throw luan.exception("bad argument #3 (step may not be zero)");
160 return new LuanFunction() { 165 return new LuanFunction() {