summaryrefslogtreecommitdiffstats
path: root/source/LuaCommandBinder.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-12 05:46:01 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-12 05:46:01 +0100
commit43e684071933adef93040e8d4b830d5c6b71cf9a (patch)
tree014e5300feb1cdbbb8f24e4e42594eeb841f0be2 /source/LuaCommandBinder.cpp
parentFixed rclk in doublechests (diff)
downloadcuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.gz
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.bz2
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.lz
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.xz
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.tar.zst
cuberite-43e684071933adef93040e8d4b830d5c6b71cf9a.zip
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;
}
+
+
+
+