In this code, when the user presses "Yes," it connects to the internet and downloads the file. However, when the user presses "No," it does not give an internet connection error. I want, when the user presses "No," to display a message informing them that the file is not allowed to connect to the internet to download the file and to open another file instead. How can I achieve this?
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.
Question
MahmoudBasem
In this code, when the user presses "Yes," it connects to the internet and downloads the file. However, when the user presses "No," it does not give an internet connection error. I want, when the user presses "No," to display a message informing them that the file is not allowed to connect to the internet to download the file and to open another file instead. How can I achieve this?
The code:
DownloadPath = gg.EXT_STORAGE .. "/Download/"
urls={'https://d.apkpure.com/b/APK/com.king.candycrushsaga?version=latest', 'https://d.apkpure.com/b/APK/com.google.android.gm?version=latest', 'https://d.apkpure.com/b/APK/com.alphainventor.filemanager?version=latest', 'https://d.apkpure.com/b/APK/com.facebook.lite?version=latest'}
names={'candy crush.apk','gmail.apk','file manager.apk','facebook lite.apk'}
Urls_name = {'كاندي كراش','جيميل','مدير ملفات','فبسبوك لايت'}
table.insert(Urls_name, 'رجوع')
selectedOption = #Urls_name -- رقم الموقع لاختيار "رجوع"
codes = gg.choice(Urls_name, nil)
if codes1==nil then -- القايمة المراد فتحها مرة اخري
end
if codes1 == selectedOption then
-- استدعاء الوظيفة للرجوع إلى القائمة السابقة
else
-- استمرار تنفيذ الخيار المحدد
local selectedUrl = urls[codes]
local selectedName = names[codes]
Time = os.clock()
getalldata = (gg.makeRequest(selectedUrl).content)
file = io.open(DownloadPath .. selectedName, "w")
file:write(getalldata)
io.close(file)
gg.toast("Dᴏᴡɴʟᴏᴀᴅ Sᴜᴄᴄᴇss
")
gg.sleep(2500)
gg.toast("Dᴏᴡɴʟᴏᴀᴅ Pᴀᴛʜ :" .. DownloadPath)
gg.sleep(2500)
gg.toast("Fɪʟᴇ Dᴏᴡɴʟᴏᴀᴅ Tɪᴍᴇ :" .. string.format("%.2f", os.clock() - Time) .. " Sᴇᴄᴏɴᴅs")
gg.sleep(2500)
gg.alert("
"..DownloadPath.."
\n
"..selectedName.."
")
end
3 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.