Mercurial Hosting > luan
comparison src/luan/interp/PowExpr.java @ 48:64ecb7a3aad7
rename Lua to Luan
git-svn-id: https://luan-java.googlecode.com/svn/trunk@49 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Fri, 28 Dec 2012 03:29:12 +0000 |
parents | a443637829c1 |
children | 8ede219cd111 |
comparison
equal
deleted
inserted
replaced
47:659c7139e903 | 48:64ecb7a3aad7 |
---|---|
1 package luan.interp; | 1 package luan.interp; |
2 | 2 |
3 import luan.Lua; | 3 import luan.Luan; |
4 import luan.LuaException; | 4 import luan.LuanException; |
5 import luan.LuaSource; | 5 import luan.LuanSource; |
6 | 6 |
7 | 7 |
8 final class PowExpr extends BinaryOpExpr { | 8 final class PowExpr extends BinaryOpExpr { |
9 | 9 |
10 PowExpr(LuaSource.Element se,Expr op1,Expr op2) { | 10 PowExpr(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(LuaStateImpl lua) throws LuaException { | 14 @Override public Object eval(LuanStateImpl lua) throws LuanException { |
15 Object o1 = op1.eval(lua); | 15 Object o1 = op1.eval(lua); |
16 Object o2 = op2.eval(lua); | 16 Object o2 = op2.eval(lua); |
17 Number n1 = Lua.toNumber(o1); | 17 Number n1 = Luan.toNumber(o1); |
18 Number n2 = Lua.toNumber(o2); | 18 Number n2 = Luan.toNumber(o2); |
19 if( n1 != null && n2 != null ) | 19 if( n1 != null && n2 != null ) |
20 return Math.pow( n1.doubleValue(), n2.doubleValue() ); | 20 return Math.pow( n1.doubleValue(), n2.doubleValue() ); |
21 return arithmetic(lua,"__pow",o1,o2); | 21 return arithmetic(lua,"__pow",o1,o2); |
22 } | 22 } |
23 } | 23 } |