comparison 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
comparison
equal deleted inserted replaced
235:f247c2ea9eef 236:1fada5587469
43 add( module, "raw_get", LuanTable.class, Object.class ); 43 add( module, "raw_get", LuanTable.class, Object.class );
44 add( module, "raw_len", LuanState.class, Object.class ); 44 add( module, "raw_len", LuanState.class, Object.class );
45 add( module, "raw_set", LuanTable.class, Object.class, Object.class ); 45 add( module, "raw_set", LuanTable.class, Object.class, Object.class );
46 add( module, "repr", LuanState.class, Object.class ); 46 add( module, "repr", LuanState.class, Object.class );
47 add( module, "set_metatable", LuanTable.class, LuanTable.class ); 47 add( module, "set_metatable", LuanTable.class, LuanTable.class );
48 add( module, "to_boolean", Object.class );
48 add( module, "to_number", Object.class, Integer.class ); 49 add( module, "to_number", Object.class, Integer.class );
49 add( module, "to_string", LuanState.class, Object.class ); 50 add( module, "to_string", LuanState.class, Object.class );
50 add( module, "type", Object.class ); 51 add( module, "type", Object.class );
51 add( module, "values", new Object[0].getClass() ); 52 add( module, "values", new Object[0].getClass() );
52 } catch(NoSuchMethodException e) { 53 } catch(NoSuchMethodException e) {
156 157
157 public static String to_string(LuanState luan,Object v) throws LuanException { 158 public static String to_string(LuanState luan,Object v) throws LuanException {
158 return luan.toString(v); 159 return luan.toString(v);
159 } 160 }
160 161
162 public static boolean to_boolean(Object v) throws LuanException {
163 return Luan.toBoolean(v);
164 }
165
161 public static void error(LuanState luan,Object msg) throws LuanException { 166 public static void error(LuanState luan,Object msg) throws LuanException {
162 throw luan.exception(msg); 167 throw luan.exception(msg);
163 } 168 }
164 169
165 public static Object assert_(LuanState luan,Object v,String msg) throws LuanException { 170 public static Object assert_(LuanState luan,Object v,String msg) throws LuanException {