summaryrefslogtreecommitdiffstats
path: root/src/Bindings
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
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 '')
-rw-r--r--src/Bindings/LuaState.cpp8
-rw-r--r--src/Bindings/LuaState.h2
-rw-r--r--src/Bindings/PluginManager.cpp1
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