From 4ccaa6d0af852d0aada01f341a61290a3760cffa Mon Sep 17 00:00:00 2001 From: sapier Date: Wed, 11 Dec 2013 23:07:38 +0100 Subject: Implement search tab and version picker --- src/script/lua_api/l_mainmenu.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/script/lua_api/l_mainmenu.cpp') diff --git a/src/script/lua_api/l_mainmenu.cpp b/src/script/lua_api/l_mainmenu.cpp index 42ddd0b14..ba8a09747 100644 --- a/src/script/lua_api/l_mainmenu.cpp +++ b/src/script/lua_api/l_mainmenu.cpp @@ -336,6 +336,26 @@ int ModApiMainMenu::l_get_modstore_details(lua_State *L) lua_pushstring(L,current_mod.versions[0].file.c_str()); lua_settable(L, top); + lua_pushstring(L,"versions"); + lua_newtable(L); + int versionstop = lua_gettop(L); + for (unsigned int i=0;i < current_mod.versions.size(); i++) { + lua_pushnumber(L,i+1); + lua_newtable(L); + int current_element = lua_gettop(L); + + lua_pushstring(L,"date"); + lua_pushstring(L,current_mod.versions[i].date.c_str()); + lua_settable(L,current_element); + + lua_pushstring(L,"download_url"); + lua_pushstring(L,current_mod.versions[i].file.c_str()); + lua_settable(L,current_element); + + lua_settable(L,versionstop); + } + lua_settable(L, top); + lua_pushstring(L,"screenshot_url"); lua_pushstring(L,current_mod.titlepic.file.c_str()); lua_settable(L, top); @@ -782,7 +802,10 @@ int ModApiMainMenu::l_extract_zip(lua_State *L) io::IFileSystem* fs = engine->m_device->getFileSystem(); - fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP); + if (!fs->addFileArchive(zipfile,true,false,io::EFAT_ZIP)) { + lua_pushboolean(L,false); + return 1; + } assert(fs->getFileArchiveCount() > 0); -- cgit v1.2.3