summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-09 00:32:02 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-05-09 00:32:02 +0200
commit218010cd96a3e887e7fbd8e18e1b74b7dc481036 (patch)
treebc4149f29ba75083b4e11aa4c5174c04bab92e08 /src/Bindings/LuaState.cpp
parentMerge pull request #1945 from Woazboat/CodeCleanup_refactored (diff)
downloadcuberite-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 '')
-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 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);
}