From 43e684071933adef93040e8d4b830d5c6b71cf9a Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 12 Jan 2013 04:46:01 +0000 Subject: Merged branch "branches/hooks" into "trunk". git-svn-id: http://mc-server.googlecode.com/svn/trunk@1139 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/LuaCommandBinder.cpp | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'source/LuaCommandBinder.cpp') diff --git a/source/LuaCommandBinder.cpp b/source/LuaCommandBinder.cpp index 75c738124..84a379c74 100644 --- a/source/LuaCommandBinder.cpp +++ b/source/LuaCommandBinder.cpp @@ -11,32 +11,48 @@ -bool report_errors(lua_State* lua, int status) +bool report_errors(lua_State * lua, int status) { - if ( status!=0 ) + if (status == 0) { - std::string s = lua_tostring(lua, -1); - LOGERROR("-- %s", s.c_str() ); - lua_pop(lua, 1); - return true; + // No error to report + return false; } - return false; + + LOGERROR("LUA: %s", lua_tostring(lua, -1)); + lua_pop(lua, 1); + return true; } + + + cLuaCommandBinder::cLuaCommandBinder() { } + + + + cLuaCommandBinder::~cLuaCommandBinder() { } + + + + void cLuaCommandBinder::ClearBindings() { m_BoundCommands.clear(); } + + + + void cLuaCommandBinder::RemoveBindingsForPlugin( cPlugin* a_Plugin ) { for( CommandMap::iterator itr = m_BoundCommands.begin(); itr != m_BoundCommands.end(); ) @@ -54,6 +70,10 @@ void cLuaCommandBinder::RemoveBindingsForPlugin( cPlugin* a_Plugin ) } } + + + + bool cLuaCommandBinder::BindCommand( const std::string & a_Command, const std::string & a_Permission, cPlugin* a_Plugin, lua_State * a_LuaState, int a_FunctionReference ) { if( !a_Plugin->CanBindCommands() ) @@ -71,6 +91,10 @@ bool cLuaCommandBinder::BindCommand( const std::string & a_Command, const std::s return true; } + + + + bool cLuaCommandBinder::HandleCommand( const std::string & a_Command, cPlayer* a_Player ) { AStringVector Split = StringSplit(a_Command, " "); @@ -124,3 +148,7 @@ bool cLuaCommandBinder::HandleCommand( const std::string & a_Command, cPlayer* a } return false; } + + + + -- cgit v1.2.3