summaryrefslogtreecommitdiffstats
path: root/source/cPlugin_NewLua.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 12:38:15 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-18 12:38:15 +0200
commit1b5eaa92b562c09ed7cea4de7186ff6541e65e5f (patch)
tree7e196c6021c1777d25ad4d79bb6530fd933a65d4 /source/cPlugin_NewLua.cpp
parentPacket refactoring, phase two, partial. Rewritten a few packet handling functions not to use cPacket-descendant objects. (diff)
downloadcuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.tar
cuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.tar.gz
cuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.tar.bz2
cuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.tar.lz
cuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.tar.xz
cuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.tar.zst
cuberite-1b5eaa92b562c09ed7cea4de7186ff6541e65e5f.zip
Diffstat (limited to 'source/cPlugin_NewLua.cpp')
-rw-r--r--source/cPlugin_NewLua.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/cPlugin_NewLua.cpp b/source/cPlugin_NewLua.cpp
index 51d2dc9df..55010c3b2 100644
--- a/source/cPlugin_NewLua.cpp
+++ b/source/cPlugin_NewLua.cpp
@@ -260,20 +260,23 @@ bool cPlugin_NewLua::OnBlockDig(cPlayer * a_Player, int a_BlockX, int a_BlockY,
-bool cPlugin_NewLua::OnChat( const char* a_Chat, cPlayer* a_Player )
+bool cPlugin_NewLua::OnChat(cPlayer * a_Player, const AString & a_Message)
{
- cCSLock Lock( m_CriticalSection );
- if( !PushFunction("OnChat") )
+ cCSLock Lock(m_CriticalSection);
+ if (!PushFunction("OnChat"))
+ {
return false;
+ }
- tolua_pushstring( m_LuaState, a_Chat );
tolua_pushusertype(m_LuaState, a_Player, "cPlayer");
+ tolua_pushstring (m_LuaState, a_Message.c_str());
- if( !CallFunction(2, 1, "OnChat") )
+ if (!CallFunction(2, 1, "OnChat"))
+ {
return false;
+ }
- bool bRetVal = (tolua_toboolean( m_LuaState, -1, 0) > 0);
- return bRetVal;
+ return (tolua_toboolean( m_LuaState, -1, 0) > 0);
}