diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-05-10 14:15:13 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2015-05-10 14:15:13 +0200 |
commit | 1cb1347c53c7482883dcc2eb047f8fe798a12481 (patch) | |
tree | be616a3c3b2db083b2f3908220818231778609ef /src/Bindings | |
parent | Merge pull request #1985 from SafwatHalaby/lessPathCalcs (diff) | |
parent | Merge remote-tracking branch 'origin/master' into warnings (diff) | |
download | cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.tar cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.tar.gz cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.tar.bz2 cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.tar.lz cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.tar.xz cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.tar.zst cuberite-1cb1347c53c7482883dcc2eb047f8fe798a12481.zip |
Diffstat (limited to '')
-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 28bf87091..c96ab083a 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 10f5ecb94..9b3c1555d 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) |