diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-11-13 20:00:01 +0100 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2016-11-13 20:00:01 +0100 |
commit | 944fdd173f40c0fcc718d6aa2af191bf993adc70 (patch) | |
tree | 28436adf7e20c58427c8d48685d944b964e11147 /src/Bindings | |
parent | Merge pull request #3430 from cuberite/Overrides (diff) | |
download | cuberite-WarningsFixes.tar cuberite-WarningsFixes.tar.gz cuberite-WarningsFixes.tar.bz2 cuberite-WarningsFixes.tar.lz cuberite-WarningsFixes.tar.xz cuberite-WarningsFixes.tar.zst cuberite-WarningsFixes.zip |
Diffstat (limited to 'src/Bindings')
-rw-r--r-- | src/Bindings/LuaState.cpp | 14 | ||||
-rw-r--r-- | src/Bindings/LuaState.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 50ce04f7c..2f01d2d4f 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -1066,6 +1066,18 @@ void cLuaState::Push(double a_Value) +void cLuaState::Push(float a_Value) +{ + ASSERT(IsValid()); + + tolua_pushnumber(m_LuaState, static_cast<double>(a_Value)); + m_NumCurrentFunctionArgs += 1; +} + + + + + void cLuaState::Push(int a_Value) { ASSERT(IsValid()); @@ -1385,7 +1397,7 @@ bool cLuaState::GetStackValue(int a_StackPos, float & a_ReturnedVal) { if (lua_isnumber(m_LuaState, a_StackPos)) { - a_ReturnedVal = static_cast<float>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal)); + a_ReturnedVal = static_cast<float>(tolua_tonumber(m_LuaState, a_StackPos, static_cast<double>(a_ReturnedVal))); return true; } return false; diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 9c97e96d4..67e6dade5 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -589,6 +589,7 @@ public: void Push(cLuaTCPLink * a_TCPLink); void Push(cLuaUDPEndpoint * a_UDPEndpoint); void Push(double a_Value); + void Push(float a_Value); void Push(int a_Value); void Push(long a_Value); void Push(const UInt32 a_Value); |