diff --git a/ElunaTemplate.cpp b/ElunaTemplate.cpp index 7d831ceb32..73a9953344 100644 --- a/ElunaTemplate.cpp +++ b/ElunaTemplate.cpp @@ -57,20 +57,20 @@ template<> inline int ElunaTemplate::Mod(lua_State* L) { ret template<> inline int ElunaTemplate::Equal(lua_State* L) { return PerformBinaryOp(L, std::equal_to()); } template<> inline int ElunaTemplate::Less(lua_State* L) { return PerformBinaryOp(L, std::less()); } template<> inline int ElunaTemplate::LessOrEqual(lua_State* L) { return PerformBinaryOp(L, std::less_equal()); } -template<> inline int ElunaTemplate::ToString(lua_State* L) { return ToStringHelper(L); } -template<> inline int ElunaTemplate::Pow(lua_State* L) { return PowHelper(L); } +template<> inline int ElunaTemplate::ToString(lua_State* L) { return ToStringHelper(L); } +template<> inline int ElunaTemplate::Pow(lua_State* L) { return PowHelper(L); } -template<> inline int ElunaTemplate::Add(lua_State* L) { return PerformBinaryOp(L, std::plus()); } -template<> inline int ElunaTemplate::Subtract(lua_State* L) { return PerformBinaryOp(L, std::minus()); } -template<> inline int ElunaTemplate::Multiply(lua_State* L) { return PerformBinaryOp(L, std::multiplies()); } -template<> inline int ElunaTemplate::Divide(lua_State* L) { return PerformBinaryOp(L, std::divides()); } -template<> inline int ElunaTemplate::Mod(lua_State* L) { return PerformBinaryOp(L, std::modulus()); } -template<> inline int ElunaTemplate::UnaryMinus(lua_State* L) { return PerformUnaryOp(L, std::negate()); } -template<> inline int ElunaTemplate::Equal(lua_State* L) { return PerformBinaryOp(L, std::equal_to()); } -template<> inline int ElunaTemplate::Less(lua_State* L) { return PerformBinaryOp(L, std::less()); } -template<> inline int ElunaTemplate::LessOrEqual(lua_State* L) { return PerformBinaryOp(L, std::less_equal()); } -template<> inline int ElunaTemplate::ToString(lua_State* L) { return ToStringHelper(L); } -template<> inline int ElunaTemplate::Pow(lua_State* L) { return PowHelper(L); } +template<> inline int ElunaTemplate::Add(lua_State* L) { return PerformBinaryOp(L, std::plus()); } +template<> inline int ElunaTemplate::Subtract(lua_State* L) { return PerformBinaryOp(L, std::minus()); } +template<> inline int ElunaTemplate::Multiply(lua_State* L) { return PerformBinaryOp(L, std::multiplies()); } +template<> inline int ElunaTemplate::Divide(lua_State* L) { return PerformBinaryOp(L, std::divides()); } +template<> inline int ElunaTemplate::Mod(lua_State* L) { return PerformBinaryOp(L, std::modulus()); } +template<> inline int ElunaTemplate::UnaryMinus(lua_State* L) { return PerformUnaryOp(L, std::negate()); } +template<> inline int ElunaTemplate::Equal(lua_State* L) { return PerformBinaryOp(L, std::equal_to()); } +template<> inline int ElunaTemplate::Less(lua_State* L) { return PerformBinaryOp(L, std::less()); } +template<> inline int ElunaTemplate::LessOrEqual(lua_State* L) { return PerformBinaryOp(L, std::less_equal()); } +template<> inline int ElunaTemplate::ToString(lua_State* L) { return ToStringHelper(L); } +template<> inline int ElunaTemplate::Pow(lua_State* L) { return PowHelper(L); } template<> inline int ElunaTemplate::Equal(lua_State* L) { Eluna* E = Eluna::GetEluna(L); E->Push(E->CHECKVAL(1) == E->CHECKVAL(2)); return 1; } template<> inline int ElunaTemplate::ToString(lua_State* L) diff --git a/ElunaTemplate.h b/ElunaTemplate.h index 63ff4f91c3..16572f5d28 100644 --- a/ElunaTemplate.h +++ b/ElunaTemplate.h @@ -474,8 +474,8 @@ class ElunaTemplate return 1; } - template - static int PerformBinaryOp(lua_State* L, std::function binaryOp) + template + static int PerformBinaryOp(lua_State* L, std::function binaryOp) { Eluna* E = Eluna::GetEluna(L); @@ -485,17 +485,16 @@ class ElunaTemplate return 1; } - template - static int PerformUnaryOp(lua_State* L, std::function unaryOp) + template + static int PerformUnaryOp(lua_State* L, std::function unaryOp) { Eluna* E = Eluna::GetEluna(L); - T val1 = E->CHECKVAL(1); - E->Push(unaryOp(val1)); + T val = E->CHECKVAL(1); + E->Push(unaryOp(val)); return 1; } - template static int ToStringHelper(lua_State* L) { Eluna* E = Eluna::GetEluna(L); @@ -507,7 +506,6 @@ class ElunaTemplate return 1; } - template static int PowHelper(lua_State* L) { Eluna* E = Eluna::GetEluna(L);