diff options
author | FakeTruth <faketruth@gmail.com> | 2013-07-29 02:37:59 +0200 |
---|---|---|
committer | FakeTruth <faketruth@gmail.com> | 2013-07-29 02:37:59 +0200 |
commit | 5a9d4f89c2212c83f05f910b6f2a176f21048ba6 (patch) | |
tree | 63414b5adfde3ff229612628a05ac1fbecb11a7b /source/ManualBindings.cpp | |
parent | Merge branch 'master' of github.com:mc-server/MCServer (diff) | |
download | cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.gz cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.bz2 cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.lz cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.xz cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.tar.zst cuberite-5a9d4f89c2212c83f05f910b6f2a176f21048ba6.zip |
Diffstat (limited to '')
-rw-r--r-- | source/ManualBindings.cpp | 61 |
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); |