diff options
Diffstat (limited to '')
-rw-r--r-- | src/Bindings/LuaState.cpp | 8 | ||||
-rw-r--r-- | src/Bindings/LuaState.h | 2 | ||||
-rw-r--r-- | src/Bindings/PluginManager.cpp | 1 |
3 files changed, 8 insertions, 3 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; } diff --git a/src/Bindings/LuaState.h b/src/Bindings/LuaState.h index 779760017..899228a66 100644 --- a/src/Bindings/LuaState.h +++ b/src/Bindings/LuaState.h @@ -363,7 +363,7 @@ protected: } /** Variadic template recursor: More params to push. Push them and recurse. */ - template<typename T, typename... Args> + template <typename T, typename... Args> inline bool PushCallPop(T a_Param, Args &&... args) { Push(a_Param); diff --git a/src/Bindings/PluginManager.cpp b/src/Bindings/PluginManager.cpp index 43507a5fb..479e71951 100644 --- a/src/Bindings/PluginManager.cpp +++ b/src/Bindings/PluginManager.cpp @@ -1828,6 +1828,7 @@ bool cPluginManager::DoWithPlugin(const AString & a_PluginName, cPluginCallback bool cPluginManager::AddPlugin(cPlugin * a_Plugin) { m_Plugins[a_Plugin->GetDirectory()] = a_Plugin; + if (a_Plugin->Initialize()) { // Initialization OK |