summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-30 10:39:15 +0200
committerMattes D <github@xoft.cz>2015-04-30 10:39:15 +0200
commit4bf3b874e396bd98ccb80b412d7095a4e12b1576 (patch)
treea8f5e48c198a99495bf0dc7390d84ed824c0ec12 /src/Bindings/LuaState.cpp
parentClay blocks are handled with the OreHandler (diff)
parentAPIDump: Added documentation for cBlockArea:GetNonAirCropRelCoords. (diff)
downloadcuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.tar
cuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.tar.gz
cuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.tar.bz2
cuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.tar.lz
cuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.tar.xz
cuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.tar.zst
cuberite-4bf3b874e396bd98ccb80b412d7095a4e12b1576.zip
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp
index 38e008b2a..ed31e678f 100644
--- a/src/Bindings/LuaState.cpp
+++ b/src/Bindings/LuaState.cpp
@@ -937,6 +937,18 @@ void cLuaState::GetStackValue(int a_StackPos, AString & a_Value)
+void cLuaState::GetStackValue(int a_StackPos, BLOCKTYPE & a_ReturnedVal)
+{
+ if (lua_isnumber(m_LuaState, a_StackPos))
+ {
+ a_ReturnedVal = static_cast<BLOCKTYPE>(tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal));
+ }
+}
+
+
+
+
+
void cLuaState::GetStackValue(int a_StackPos, bool & a_ReturnedVal)
{
a_ReturnedVal = (tolua_toboolean(m_LuaState, a_StackPos, a_ReturnedVal ? 1 : 0) > 0);
@@ -995,6 +1007,24 @@ void cLuaState::GetStackValue(int a_StackPos, int & a_ReturnedVal)
+void cLuaState::GetStackValue(int a_StackPos, pBlockArea & a_ReturnedVal)
+{
+ if (lua_isnil(m_LuaState, a_StackPos))
+ {
+ a_ReturnedVal = nullptr;
+ return;
+ }
+ tolua_Error err;
+ if (tolua_isusertype(m_LuaState, a_StackPos, "cBlockArea", false, &err))
+ {
+ a_ReturnedVal = *(reinterpret_cast<cBlockArea **>(lua_touserdata(m_LuaState, a_StackPos)));
+ }
+}
+
+
+
+
+
void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
{
if (lua_isnil(m_LuaState, a_StackPos))
@@ -1005,7 +1035,7 @@ void cLuaState::GetStackValue(int a_StackPos, pBoundingBox & a_ReturnedVal)
tolua_Error err;
if (tolua_isusertype(m_LuaState, a_StackPos, "cBoundingBox", false, &err))
{
- a_ReturnedVal = *((cBoundingBox **)lua_touserdata(m_LuaState, a_StackPos));
+ a_ReturnedVal = *(reinterpret_cast<cBoundingBox **>(lua_touserdata(m_LuaState, a_StackPos)));
}
}