summaryrefslogtreecommitdiffstats
path: root/src/Bindings/LuaState.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 20:01:53 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 20:01:53 +0200
commit2334c8dd9d6a295e3c445e548b5902c9f49ab532 (patch)
tree914eb4019ea6ca8e1f3c92198b910c05f3a6ecbc /src/Bindings/LuaState.cpp
parentMigrated cSleep and cTimer to std::chrono (diff)
parentMerge pull request #1554 from SphinxC0re/master (diff)
downloadcuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.gz
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.bz2
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.lz
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.xz
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.tar.zst
cuberite-2334c8dd9d6a295e3c445e548b5902c9f49ab532.zip
Diffstat (limited to 'src/Bindings/LuaState.cpp')
-rw-r--r--src/Bindings/LuaState.cpp8
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;
}