示例#1
0
 public LuaValue call(LuaValue modname, LuaValue env) {
   super.call(modname, env);
   LuaValue math = env.get("math");
   math.set("acos", new acos());
   math.set("asin", new asin());
   math.set("atan", new atan());
   math.set("atan2", new atan2());
   math.set("cosh", new cosh());
   math.set("exp", new exp());
   math.set("log", new log());
   math.set("pow", new pow());
   math.set("sinh", new sinh());
   math.set("tanh", new tanh());
   return math;
 }
 private static Object toJava(LuaValue luajValue) {
   switch (luajValue.type()) {
     case LuaValue.TNIL:
       return null;
     case LuaValue.TSTRING:
       return luajValue.tojstring();
     case LuaValue.TUSERDATA:
       return luajValue.checkuserdata(Object.class);
     case LuaValue.TNUMBER:
       return luajValue.isinttype()
           ? (Object) new Integer(luajValue.toint())
           : (Object) new Double(luajValue.todouble());
     default:
       return luajValue;
   }
 }