diff options
author | tycho <tycho@localhost> | 2015-03-21 18:17:26 +0100 |
---|---|---|
committer | tycho <tycho@localhost> | 2015-05-07 04:47:46 +0200 |
commit | 448df85e569e85e1b4da4eac685950273f30ae1f (patch) | |
tree | 045241fff430ae2ffe0b97d7151e44293ad76467 /src/Bindings/LuaState.cpp | |
parent | Merge pull request #1946 from SafwatHalaby/lean (diff) | |
download | cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.tar cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.tar.gz cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.tar.bz2 cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.tar.lz cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.tar.xz cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.tar.zst cuberite-448df85e569e85e1b4da4eac685950273f30ae1f.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index ed31e678f..f574dbe26 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -1133,6 +1133,23 @@ void cLuaState::GetStackValue(int a_StackPos, pWorld & a_ReturnedVal) +void cLuaState::GetStackValue(int a_StackPos, pClientHandle & a_ReturnedVal) +{ + if (lua_isnil(m_LuaState, a_StackPos)) + { + a_ReturnedVal = nullptr; + return; + } + tolua_Error err; + if (tolua_isusertype(m_LuaState, a_StackPos, "cClientHandle", false, &err)) + { + a_ReturnedVal = *(reinterpret_cast<cClientHandle **>(lua_touserdata(m_LuaState, a_StackPos))); + } +} + + + + bool cLuaState::CallFunction(int a_NumResults) { ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first @@ -1415,6 +1432,30 @@ bool cLuaState::CheckParamEnd(int a_Param) +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); +} + + + + + +bool cLuaState::IsParamNumber(int a_Param) +{ + ASSERT(IsValid()); + + tolua_Error tolua_err; + return tolua_isnumber(m_LuaState, a_Param, 0, &tolua_err); +} + + + + + bool cLuaState::ReportErrors(int a_Status) { return ReportErrors(m_LuaState, a_Status); |