summaryrefslogtreecommitdiffstats
path: root/source/LuaCommandBinder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/LuaCommandBinder.cpp')
-rw-r--r--source/LuaCommandBinder.cpp42
1 files changed, 35 insertions, 7 deletions
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;
}
+
+
+
+