diff options
author | Mattes D <github@xoft.cz> | 2015-05-07 16:14:56 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-05-07 16:14:56 +0200 |
commit | 4888f671d15c47cf79b289a72fb5068cc6a6e35b (patch) | |
tree | 462ab2388a09dada48478104553fb9f6fedcb358 /src/Bindings/LuaState.cpp | |
parent | Merge pull request #1953 from mc-server/bearbin-fadwp (diff) | |
parent | Added support for additional data in the ParticleEffect Packet (diff) | |
download | cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.gz cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.bz2 cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.lz cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.xz cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.tar.zst cuberite-4888f671d15c47cf79b289a72fb5068cc6a6e35b.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); |