summaryrefslogtreecommitdiffstats
path: root/src/Bindings/ManualBindings.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-04-19 14:35:04 +0200
committerMattes D <github@xoft.cz>2015-04-19 14:35:04 +0200
commit288d2280fa85225613534ae56a59e35465bbefe2 (patch)
tree85234752e9cd96f21fcdc56d48f3ae651bdc7c1a /src/Bindings/ManualBindings.cpp
parentSplit the plugin names and plugin folders to avoid confusing them. (diff)
downloadcuberite-288d2280fa85225613534ae56a59e35465bbefe2.tar
cuberite-288d2280fa85225613534ae56a59e35465bbefe2.tar.gz
cuberite-288d2280fa85225613534ae56a59e35465bbefe2.tar.bz2
cuberite-288d2280fa85225613534ae56a59e35465bbefe2.tar.lz
cuberite-288d2280fa85225613534ae56a59e35465bbefe2.tar.xz
cuberite-288d2280fa85225613534ae56a59e35465bbefe2.tar.zst
cuberite-288d2280fa85225613534ae56a59e35465bbefe2.zip
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r--src/Bindings/ManualBindings.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp
index aebdbc34b..4c8d9ff96 100644
--- a/src/Bindings/ManualBindings.cpp
+++ b/src/Bindings/ManualBindings.cpp
@@ -2647,22 +2647,16 @@ static int tolua_AllToLua_cWebAdmin_GetURLEncodedString(lua_State * tolua_S)
static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S)
{
- cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S, 1, nullptr);
-
- const cWebPlugin::TabNameList & TabNames = self->GetTabNames();
-
+ // Returns a map of (SafeTitle -> Title) for the plugin's web tabs.
+ auto self = reinterpret_cast<cWebPlugin *>(tolua_tousertype(tolua_S, 1, nullptr));
+ auto TabNames = self->GetTabNames();
lua_newtable(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());
- //
+ for (auto itr = TabNames.cbegin(), end = TabNames.cend(); itr != end; ++itr)
+ {
+ tolua_pushstring(tolua_S, itr->second.c_str()); // Because the SafeTitle is supposed to be unique, use it as key
+ tolua_pushstring(tolua_S, itr->first.c_str());
lua_rawset(tolua_S, -3);
- ++iter;
++index;
}
return 1;