diff options
author | Mattes D <github@xoft.cz> | 2014-10-20 17:32:09 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-10-20 17:32:09 +0200 |
commit | b78078a3a677ee6aeabb55077a0db6604c5fe09d (patch) | |
tree | ebe67627dfe6de6139571d5528f0dfc2de136e7a | |
parent | Merge pull request #1553 from SphinxC0re/work (diff) | |
download | cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.tar cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.tar.gz cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.tar.bz2 cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.tar.lz cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.tar.xz cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.tar.zst cuberite-b78078a3a677ee6aeabb55077a0db6604c5fe09d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Bindings/LuaState.cpp b/src/Bindings/LuaState.cpp index 2c4d89b01..142242162 100644 --- a/src/Bindings/LuaState.cpp +++ b/src/Bindings/LuaState.cpp @@ -558,7 +558,11 @@ void cLuaState::Push(cEntity * a_Entity) { ASSERT(IsValid()); - if (a_Entity->IsMob()) + if (a_Entity == nullptr) + { + lua_pushnil(m_LuaState); + } + else if (a_Entity->IsMob()) { // Don't push specific mob types, as those are not exported in the API: tolua_pushusertype(m_LuaState, a_Entity, "cMonster"); @@ -566,7 +570,7 @@ void cLuaState::Push(cEntity * a_Entity) else { // Push the specific class type: - tolua_pushusertype(m_LuaState, a_Entity, (a_Entity == nullptr) ? "cEntity" : a_Entity->GetClass()); + tolua_pushusertype(m_LuaState, a_Entity, a_Entity->GetClass()); } m_NumCurrentFunctionArgs += 1; } |