diff core/src/luan/modules/BasicLuan.java @ 236:1fada5587469

add Basic.to_boolean and change "not" operator to require a boolean git-svn-id: https://luan-java.googlecode.com/svn/trunk@237 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sun, 05 Oct 2014 09:11:10 +0000
parents ef39bc4d3f70
children 705d14f4d8ee
line wrap: on
line diff
--- a/core/src/luan/modules/BasicLuan.java	Sun Oct 05 04:42:04 2014 +0000
+++ b/core/src/luan/modules/BasicLuan.java	Sun Oct 05 09:11:10 2014 +0000
@@ -45,6 +45,7 @@
 				add( module, "raw_set", LuanTable.class, Object.class, Object.class );
 				add( module, "repr", LuanState.class, Object.class );
 				add( module, "set_metatable", LuanTable.class, LuanTable.class );
+				add( module, "to_boolean", Object.class );
 				add( module, "to_number", Object.class, Integer.class );
 				add( module, "to_string", LuanState.class, Object.class );
 				add( module, "type", Object.class );
@@ -158,6 +159,10 @@
 		return luan.toString(v);
 	}
 
+	public static boolean to_boolean(Object v) throws LuanException {
+		return Luan.toBoolean(v);
+	}
+
 	public static void error(LuanState luan,Object msg) throws LuanException {
 		throw luan.exception(msg);
 	}