aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2018-06-18 20:47:38 +0100
committerGitHub <noreply@github.com>2018-06-18 20:47:38 +0100
commitca502fc274c640f1e301a77ecb336ab5a23d348d (patch)
tree41c38f278225e21067144330a4c6195eecee963b /src/script
parente8b687d7cafd7ff77572238cf98954527ab1056a (diff)
downloadminetest-ca502fc274c640f1e301a77ecb336ab5a23d348d.tar.gz
minetest-ca502fc274c640f1e301a77ecb336ab5a23d348d.tar.bz2
minetest-ca502fc274c640f1e301a77ecb336ab5a23d348d.zip
Update to new ContentDB API
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_mainmenu.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp
index 1f49fc211..a5b211bc7 100644
--- a/src/script/lua_api/l_mainmenu.cpp
+++ b/src/script/lua_api/l_mainmenu.cpp
@@ -1005,7 +1005,7 @@ int ModApiMainMenu::l_get_screen_info(lua_State *L)
int ModApiMainMenu::l_get_package_list(lua_State *L)
{
std::string url = g_settings->get("contentdb_url");
- std::vector<Package> packages = getPackagesFromURL(url + "/packages/");
+ std::vector<Package> packages = getPackagesFromURL(url + "/api/packages/");
// Make table
lua_newtable(L);
@@ -1019,6 +1019,10 @@ int ModApiMainMenu::l_get_package_list(lua_State *L)
int top_lvl2 = lua_gettop(L);
+ lua_pushstring(L, "author");
+ lua_pushstring(L, package.author.c_str());
+ lua_settable (L, top_lvl2);
+
lua_pushstring(L, "name");
lua_pushstring(L, package.name.c_str());
lua_settable (L, top_lvl2);
@@ -1027,10 +1031,6 @@ int ModApiMainMenu::l_get_package_list(lua_State *L)
lua_pushstring(L, package.title.c_str());
lua_settable (L, top_lvl2);
- lua_pushstring(L, "author");
- lua_pushstring(L, package.author.c_str());
- lua_settable (L, top_lvl2);
-
lua_pushstring(L, "type");
lua_pushstring(L, package.type.c_str());
lua_settable (L, top_lvl2);
@@ -1039,25 +1039,19 @@ int ModApiMainMenu::l_get_package_list(lua_State *L)
lua_pushstring(L, package.shortDesc.c_str());
lua_settable (L, top_lvl2);
- lua_pushstring(L, "url");
- lua_pushstring(L, package.url.c_str());
- lua_settable (L, top_lvl2);
-
lua_pushstring (L, "release");
lua_pushinteger(L, package.release);
lua_settable (L, top_lvl2);
- lua_pushstring(L, "screenshots");
- lua_newtable(L);
- {
- int top_screenshots = lua_gettop(L);
- for (size_t i = 0; i < package.screenshots.size(); ++i) {
- lua_pushnumber(L, i + 1);
- lua_pushstring(L, package.screenshots[i].c_str());
- lua_settable(L, top_screenshots);
- }
+ if (package.thumbnail != "") {
+ lua_pushstring(L, "thumbnail");
+ lua_pushstring(L, package.thumbnail.c_str());
+ lua_settable (L, top_lvl2);
}
- lua_settable(L, top_lvl2);
+
+ lua_pushstring(L, "url");
+ lua_pushstring(L, package.getDownloadURL(url).c_str());
+ lua_settable (L, top_lvl2);
lua_settable(L, top);
index++;