diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-22 21:08:34 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-06-22 21:08:34 +0200 |
commit | 943dcaea14c7530eecca57af015f1007b3b9630f (patch) | |
tree | 5f6f3c95c67d22810dc349b7831d10a64d89b480 /source/Plugin_NewLua.cpp | |
parent | Added the End height and composition generators. (diff) | |
download | cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.tar cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.tar.gz cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.tar.bz2 cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.tar.lz cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.tar.xz cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.tar.zst cuberite-943dcaea14c7530eecca57af015f1007b3b9630f.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Plugin_NewLua.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/Plugin_NewLua.cpp b/source/Plugin_NewLua.cpp index 885184c12..335ac000a 100644 --- a/source/Plugin_NewLua.cpp +++ b/source/Plugin_NewLua.cpp @@ -228,7 +228,7 @@ bool cPlugin_NewLua::OnBlockToPickups(cWorld * a_World, cEntity * a_Digger, int -bool cPlugin_NewLua::OnChat(cPlayer * a_Player, const AString & a_Message) +bool cPlugin_NewLua::OnChat(cPlayer * a_Player, AString & a_Message) { cCSLock Lock(m_CriticalSection); const char * FnName = GetHookFnName(cPluginManager::HOOK_CHAT); @@ -241,13 +241,17 @@ bool cPlugin_NewLua::OnChat(cPlayer * a_Player, const AString & a_Message) tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); tolua_pushstring (m_LuaState, a_Message.c_str()); - if (!CallFunction(2, 1, FnName)) + if (!CallFunction(2, 2, FnName)) { return false; } - bool bRetVal = (tolua_toboolean(m_LuaState, -1, 0) > 0); - lua_pop(m_LuaState, 1); + bool bRetVal = (tolua_toboolean(m_LuaState, -2, 0) > 0); + if (lua_isstring(m_LuaState, -1)) + { + a_Message = tolua_tostring(m_LuaState, -1, ""); + } + lua_pop(m_LuaState, 2); return bRetVal; } |