summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-12-05 22:03:07 +0100
committermadmaxoft <github@xoft.cz>2013-12-05 22:03:07 +0100
commit1205c540eea3587bb0e822a95404728424917e0b (patch)
tree48d2c99c5702c964ccfb3fce6373c878108040ba /src
parentProtoProxy: Fixed metadata parsing. (diff)
downloadcuberite-1205c540eea3587bb0e822a95404728424917e0b.tar
cuberite-1205c540eea3587bb0e822a95404728424917e0b.tar.gz
cuberite-1205c540eea3587bb0e822a95404728424917e0b.tar.bz2
cuberite-1205c540eea3587bb0e822a95404728424917e0b.tar.lz
cuberite-1205c540eea3587bb0e822a95404728424917e0b.tar.xz
cuberite-1205c540eea3587bb0e822a95404728424917e0b.tar.zst
cuberite-1205c540eea3587bb0e822a95404728424917e0b.zip
Diffstat (limited to 'src')
-rw-r--r--src/ManualBindings.cpp29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/ManualBindings.cpp b/src/ManualBindings.cpp
index 02b3347f6..2483cbef0 100644
--- a/src/ManualBindings.cpp
+++ b/src/ManualBindings.cpp
@@ -985,28 +985,26 @@ static int tolua_cWorld_QueueTask(lua_State * tolua_S)
static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
{
- cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0);
+ cPluginManager * self = (cPluginManager *)tolua_tousertype(tolua_S, 1, 0);
const cPluginManager::PluginMap & AllPlugins = self->GetAllPlugins();
lua_newtable(tolua_S);
- //lua_createtable(tolua_S, AllPlugins.size(), 0);
int newTable = lua_gettop(tolua_S);
int index = 1;
cPluginManager::PluginMap::const_iterator iter = AllPlugins.begin();
- while(iter != AllPlugins.end())
+ while (iter != AllPlugins.end())
{
const cPlugin* Plugin = iter->second;
- tolua_pushstring( tolua_S, iter->first.c_str() );
- if( Plugin != NULL )
+ tolua_pushstring(tolua_S, iter->first.c_str());
+ if (Plugin != NULL)
{
- tolua_pushusertype( tolua_S, (void*)Plugin, "const cPlugin" );
+ tolua_pushusertype(tolua_S, (void *)Plugin, "const cPlugin");
}
else
{
tolua_pushboolean(tolua_S, 0);
}
- //lua_rawseti(tolua_S, newTable, index);
lua_rawset(tolua_S, -3);
++iter;
++index;
@@ -1018,6 +1016,22 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State * tolua_S)
+static int tolua_cPluginManager_GetCurrentPlugin(lua_State * S)
+{
+ cPluginLua * Plugin = GetLuaPlugin(S);
+ if (Plugin == NULL)
+ {
+ // An error message has already been printed in GetLuaPlugin()
+ return 0;
+ }
+ tolua_pushusertype(S, Plugin, "cPluginLua");
+ return 1;
+}
+
+
+
+
+
static int tolua_cPluginManager_AddHook_FnRef(cPluginManager * a_PluginManager, cLuaState & S, int a_ParamIdx)
{
// Helper function for cPluginmanager:AddHook() binding
@@ -2231,6 +2245,7 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_function(tolua_S, "ForEachCommand", tolua_cPluginManager_ForEachCommand);
tolua_function(tolua_S, "ForEachConsoleCommand", tolua_cPluginManager_ForEachConsoleCommand);
tolua_function(tolua_S, "GetAllPlugins", tolua_cPluginManager_GetAllPlugins);
+ tolua_function(tolua_S, "GetCurrentPlugin", tolua_cPluginManager_GetCurrentPlugin);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cPlayer");