From 41ba1a7642105ac21b67f4febac3eceef6a39f0a Mon Sep 17 00:00:00 2001 From: faketruth Date: Sat, 13 Oct 2012 23:34:47 +0000 Subject: Completely removed support for old style Lua plugins (can use both Plugin and NewPlugin in settings.ini for now) Removed cPlugin_Lua, obviously cPluginManager stores plugins by their (folder)name cPluginManager now scans the Plugins folder for potential plugins and adds them as non-loaded plugins Added a DisablePlugin and LoadPlugin to disable and load plugins on a per-plugin basis instead of all at once cPluginManager::FindPlugins refreshes the plugin list by removing non-existing plugins and adding new plugins Made it incredibly easy to use new plugins from the WebAdmin Exposed some food/hunger related functions in cPlayer to Lua git-svn-id: http://mc-server.googlecode.com/svn/trunk@959 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/ManualBindings.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'source/ManualBindings.cpp') diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index dca4e0083..39677b7a8 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -521,17 +521,27 @@ static int tolua_cPluginManager_GetAllPlugins(lua_State* tolua_S) { cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const cPluginManager::PluginList & AllPlugins = self->GetAllPlugins(); + const cPluginManager::PluginMap & AllPlugins = self->GetAllPlugins(); - lua_createtable(tolua_S, AllPlugins.size(), 0); + lua_newtable(tolua_S); + //lua_createtable(tolua_S, AllPlugins.size(), 0); int newTable = lua_gettop(tolua_S); int index = 1; - cPluginManager::PluginList::const_iterator iter = AllPlugins.begin(); + cPluginManager::PluginMap::const_iterator iter = AllPlugins.begin(); while(iter != AllPlugins.end()) { - const cPlugin* Plugin = *iter; - tolua_pushusertype( tolua_S, (void*)Plugin, "const cPlugin" ); - lua_rawseti(tolua_S, newTable, index); + const cPlugin* Plugin = iter->second; + tolua_pushstring( tolua_S, iter->first.c_str() ); + if( Plugin != NULL ) + { + 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; } -- cgit v1.2.3