comparison src/luan/lib/MathLib.java @ 112:f5af13062b10

fix previous rev git-svn-id: https://luan-java.googlecode.com/svn/trunk@113 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 23 May 2014 22:52:39 +0000
parents 3c404a296995
children f537ff5e511d
comparison
equal deleted inserted replaced
111:2428ecfed375 112:f5af13062b10
9 public final class MathLib { 9 public final class MathLib {
10 10
11 public static final String NAME = "Math"; 11 public static final String NAME = "Math";
12 12
13 public static final LuanFunction LOADER = new LuanFunction() { 13 public static final LuanFunction LOADER = new LuanFunction() {
14 @Override public Object[] call(LuanState luan,Object[] args) { 14 @Override public Object call(LuanState luan,Object[] args) {
15 LuanTable module = new LuanTable(); 15 LuanTable module = new LuanTable();
16 try { 16 try {
17 add( module, "abs", Double.TYPE ); 17 add( module, "abs", Double.TYPE );
18 add( module, "acos", Double.TYPE ); 18 add( module, "acos", Double.TYPE );
19 add( module, "asin", Double.TYPE ); 19 add( module, "asin", Double.TYPE );
39 add( module, "tan", Double.TYPE ); 39 add( module, "tan", Double.TYPE );
40 add( module, "tanh", Double.TYPE ); 40 add( module, "tanh", Double.TYPE );
41 } catch(NoSuchMethodException e) { 41 } catch(NoSuchMethodException e) {
42 throw new RuntimeException(e); 42 throw new RuntimeException(e);
43 } 43 }
44 return new Object[]{module}; 44 return module;
45 } 45 }
46 }; 46 };
47 47
48 private static void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException { 48 private static void add(LuanTable t,String method,Class<?>... parameterTypes) throws NoSuchMethodException {
49 t.put( method, new LuanJavaFunction(MathLib.class.getMethod(method,parameterTypes),null) ); 49 t.put( method, new LuanJavaFunction(MathLib.class.getMethod(method,parameterTypes),null) );