diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-05-09 00:32:02 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-05-09 00:32:02 +0200 |
commit | 218010cd96a3e887e7fbd8e18e1b74b7dc481036 (patch) | |
tree | bc4149f29ba75083b4e11aa4c5174c04bab92e08 /src/Bindings | |
parent | Merge pull request #1945 from Woazboat/CodeCleanup_refactored (diff) | |
download | cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.tar cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.tar.gz cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.tar.bz2 cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.tar.lz cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.tar.xz cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.tar.zst cuberite-218010cd96a3e887e7fbd8e18e1b74b7dc481036.zip |
Diffstat (limited to 'src/Bindings')
-rw-r--r-- | src/Bindings/LuaState.cpp | 18 | ||||
-rw-r--r-- | src/Bindings/LuaState.h | 1 | ||||
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 4 |
3 files changed, 18 insertions, 5 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 9c1e2865c..fe47d45db 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -979,6 +979,18 @@ void cLuaState::GetStackValue(int a_StackPos, double & a_ReturnedVal) +void 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)); + } +} + + + + + void cLuaState::GetStackValue(int a_StackPos, eWeather & a_ReturnedVal) { if (!lua_isnumber(m_LuaState, a_StackPos)) @@ -1415,7 +1427,7 @@ bool cLuaState::CheckParamFunctionOrNil(int a_StartParam, int a_EndParam) bool cLuaState::CheckParamEnd(int a_Param) { tolua_Error tolua_err; - if (tolua_isnoobj(m_LuaState, a_Param, &tolua_err)) + if (tolua_isnoobj(m_LuaState, a_Param, &tolua_err) == 1) { return true; } @@ -1437,7 +1449,7 @@ bool cLuaState::IsParamUserType(int a_Param, AString a_UserType) ASSERT(IsValid()); tolua_Error tolua_err; - return tolua_isusertype(m_LuaState, a_Param, a_UserType.c_str(), 0, &tolua_err); + return (tolua_isusertype(m_LuaState, a_Param, a_UserType.c_str(), 0, &tolua_err) == 1); } @@ -1449,7 +1461,7 @@ bool cLuaState::IsParamNumber(int a_Param) ASSERT(IsValid()); tolua_Error tolua_err; - return tolua_isnumber(m_LuaState, a_Param, 0, &tolua_err); + return (tolua_isnumber(m_LuaState, a_Param, 0, &tolua_err) == 1); } diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 3f2e828f3..4377ed5d0 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -251,6 +251,7 @@ public: void GetStackValue(int a_StackPos, bool & a_Value); void GetStackValue(int a_StackPos, cRef & a_Ref); void GetStackValue(int a_StackPos, double & a_Value); + void GetStackValue(int a_StackPos, float & a_ReturnedVal); void GetStackValue(int a_StackPos, eWeather & a_Value); void GetStackValue(int a_StackPos, int & a_Value); void GetStackValue(int a_StackPos, pBlockArea & a_Value); diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 20042a780..e87c02181 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2036,8 +2036,8 @@ static int tolua_cWorld_BroadcastParticleEffect(lua_State * tolua_S) // Read the params: cWorld * World = nullptr; AString Name; - double PosX, PosY, PosZ, OffX, OffY, OffZ; - double ParticleData; + float PosX, PosY, PosZ, OffX, OffY, OffZ; + float ParticleData; int ParticleAmmount; L.GetStackValues(1, World, Name, PosX, PosY, PosZ, OffX, OffY, OffZ, ParticleData, ParticleAmmount); if (World == nullptr) |