summaryrefslogtreecommitdiffstats
path: root/source/ManualBindings.cpp
diff options
context:
space:
mode:
authorbearbin <bearbin@gmail.com>2013-07-29 08:32:59 +0200
committerbearbin <bearbin@gmail.com>2013-07-29 08:32:59 +0200
commit798f887b65d1068ddaf072f3a3e62aef5513021a (patch)
tree750de34f6a2aa7c2dd3cb834d9596284f8726b6b /source/ManualBindings.cpp
parentFixed multiple issues with the COMPILING file, including a missing endline terminator, windows line endings and also the exclusion of the addm32 thing. (diff)
parentMerge pull request #16 from mc-server/master (diff)
downloadcuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.tar
cuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.tar.gz
cuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.tar.bz2
cuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.tar.lz
cuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.tar.xz
cuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.tar.zst
cuberite-798f887b65d1068ddaf072f3a3e62aef5513021a.zip
Diffstat (limited to 'source/ManualBindings.cpp')
-rw-r--r--source/ManualBindings.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp
index 30648a8b7..7a13d94c0 100644
--- a/source/ManualBindings.cpp
+++ b/source/ManualBindings.cpp
@@ -1272,6 +1272,59 @@ static int tolua_get_HTTPRequest_FormData(lua_State* tolua_S)
+static int tolua_cWebAdmin_GetPlugins(lua_State * tolua_S)
+{
+ cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0);
+
+ const cWebAdmin::PluginList & AllPlugins = self->GetPlugins();
+
+ lua_createtable(tolua_S, AllPlugins.size(), 0);
+ int newTable = lua_gettop(tolua_S);
+ int index = 1;
+ cWebAdmin::PluginList::const_iterator iter = AllPlugins.begin();
+ while(iter != AllPlugins.end())
+ {
+ const cWebPlugin* Plugin = *iter;
+ tolua_pushusertype( tolua_S, (void*)Plugin, "const cWebPlugin" );
+ lua_rawseti(tolua_S, newTable, index);
+ ++iter;
+ ++index;
+ }
+ return 1;
+}
+
+
+
+
+
+static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
+{
+ cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S,1,0);
+
+ const cWebPlugin::TabNameList & TabNames = self->GetTabNames();
+
+ lua_newtable(tolua_S);
+ int newTable = lua_gettop(tolua_S);
+ int index = 1;
+ cWebPlugin::TabNameList::const_iterator iter = TabNames.begin();
+ while(iter != TabNames.end())
+ {
+ const AString & FancyName = iter->first;
+ const AString & WebName = iter->second;
+ tolua_pushstring( tolua_S, WebName.c_str() ); // Because the WebName is supposed to be unique, use it as key
+ tolua_pushstring( tolua_S, FancyName.c_str() );
+ //
+ lua_rawset(tolua_S, -3);
+ ++iter;
+ ++index;
+ }
+ return 1;
+}
+
+
+
+
+
static int Lua_ItemGrid_GetSlotCoords(lua_State * L)
{
tolua_Error tolua_err;
@@ -1377,6 +1430,14 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_variable(tolua_S,"PostParams",tolua_get_HTTPRequest_PostParams,0);
tolua_variable(tolua_S,"FormData",tolua_get_HTTPRequest_FormData,0);
tolua_endmodule(tolua_S);
+
+ tolua_beginmodule(tolua_S, "cWebAdmin");
+ tolua_function(tolua_S, "GetPlugins", tolua_cWebAdmin_GetPlugins);
+ tolua_endmodule(tolua_S);
+
+ tolua_beginmodule(tolua_S, "cWebPlugin");
+ tolua_function(tolua_S, "GetTabNames", tolua_cWebPlugin_GetTabNames);
+ tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cClientHandle");
tolua_constant(tolua_S, "MIN_VIEW_DISTANCE", cClientHandle::MIN_VIEW_DISTANCE);