comparison src/luan/interp/AddExpr.java @ 49:8ede219cd111

add WebShell git-svn-id: https://luan-java.googlecode.com/svn/trunk@50 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 28 Dec 2012 19:35:04 +0000
parents 64ecb7a3aad7
children
comparison
equal deleted inserted replaced
48:64ecb7a3aad7 49:8ede219cd111
9 9
10 AddExpr(LuanSource.Element se,Expr op1,Expr op2) { 10 AddExpr(LuanSource.Element se,Expr op1,Expr op2) {
11 super(se,op1,op2); 11 super(se,op1,op2);
12 } 12 }
13 13
14 @Override public Object eval(LuanStateImpl lua) throws LuanException { 14 @Override public Object eval(LuanStateImpl luan) throws LuanException {
15 Object o1 = op1.eval(lua); 15 Object o1 = op1.eval(luan);
16 Object o2 = op2.eval(lua); 16 Object o2 = op2.eval(luan);
17 Number n1 = Luan.toNumber(o1); 17 Number n1 = Luan.toNumber(o1);
18 Number n2 = Luan.toNumber(o2); 18 Number n2 = Luan.toNumber(o2);
19 if( n1 != null && n2 != null ) 19 if( n1 != null && n2 != null )
20 return n1.doubleValue() + n2.doubleValue(); 20 return n1.doubleValue() + n2.doubleValue();
21 return arithmetic(lua,"__add",o1,o2); 21 return arithmetic(luan,"__add",o1,o2);
22 } 22 }
23 } 23 }