diff src/luan/LuanBit.java @ 151:c9100f29fae0

conditions must be type boolean git-svn-id: https://luan-java.googlecode.com/svn/trunk@152 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 16 Jun 2014 10:37:06 +0000
parents 14281d5bd36f
children
line wrap: on
line diff
--- a/src/luan/LuanBit.java	Mon Jun 16 10:11:48 2014 +0000
+++ b/src/luan/LuanBit.java	Mon Jun 16 10:37:06 2014 +0000
@@ -61,6 +61,12 @@
 		throw exception( "attempt to call a " + Luan.type(obj) + " value" );
 	}
 
+	public Boolean checkBoolean(Object obj) throws LuanException {
+		if( obj instanceof Boolean )
+			return (Boolean)obj;
+		throw exception( "attempt to use a " + Luan.type(obj) + " as a boolean" );
+	}
+
 	public String toString(Object obj) throws LuanException {
 		LuanFunction fn = getHandlerFunction("__tostring",obj);
 		if( fn != null )