summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-10 14:15:13 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-10 14:15:13 +0200
commit1cb1347c53c7482883dcc2eb047f8fe798a12481 (patch)
treebe616a3c3b2db083b2f3908220818231778609ef /src/Bindings/LuaState.cpp
parentMerge pull request #1985 from SafwatHalaby/lessPathCalcs (diff)
parentMerge remote-tracking branch 'origin/master' into warnings (diff)
downloadcuberite-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.cpp18
1 files changed, 15 insertions, 3 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);
}