Skip to content

Instantly share code, notes, and snippets.

@sapier

sapier/gist:7698929

Created Nov 28, 2013
Embed
What would you like to do?
if fields[installbtn] then
local modlistentry =
modstore.current_list.page * modstore.modsperpage + i
if modstore.modlist_unsorted.data[modlistentry] ~= nil and
modstore.modlist_unsorted.data[modlistentry].details ~= nil then
local moddetails = modstore.modlist_unsorted.data[modlistentry].details
local fullurl = engine.setting_get("modstore_download_url") ..
moddetails.download_url
local modfilename = os.tempfolder() .. ".zip"
if engine.download_file(fullurl,modfilename) then
modmgr.installmod(modfilename,moddetails.basename)
os.remove(modfilename)
if modstore.lastmodtitle ~= "" then
modstore.lastmodtitle = modstore.lastmodtitle .. ", "
end
modstore.lastmodtitle = modstore.lastmodtitle ..
modstore.current_list.data[modlistentry].title
return {
current_tab = "modstore_mod_installed",
is_dialog = true,
show_buttons = false
}
else
gamedata.errormessage = "Unable to download " ..
moddetails.download_url .. " (internet connection?)"
end
else
gamedata.errormessage =
"Internal modstore error please leave modstore and reopen! (Sorry)"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment