View previous topic :: View next topic |
Author |
Message |
usernotfound Expert Cheater Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Sun Feb 04, 2018 3:12 pm Post subject: Script to paste contents from a URL and refresh the page |
|
|
Hello Lua section it's been a while, I'm a bit rusty with scripting these days so I could use some help on how to get started with a script like this.
What I want to do is have a script go to a webpage that has one line of text in it, copy that text to a list (most likely will use Luas io file methods for this), and then refresh the page and repeat that process until the script is stopped. The page would be something like this: https://puu.sh/zgFNX/d0a425a4ef.txt
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sun Feb 04, 2018 4:06 pm Post subject: |
|
|
not really my expertise but perhaps something basic will get you pointed in the right direction
Code: | local net = getInternet()
local lines = {}
function doStuffWithContents(contents)
lines[#lines+1] = contents
end
for i=0, 10 do -- some loop until you decide to stop eg. "while doStuff do .. end"
-- contents will be string of result, or nil if it failed
local contents = net.getURL('https://puu.sh/zgFNX/d0a425a4ef.txt')
doStuffWithContents(contents)
end
-- do whatever with stuff afterwards
print(table.concat(lines, '\r\n')) |
|
|
Back to top |
|
|
usernotfound Expert Cheater Reputation: 0
Joined: 21 Feb 2016 Posts: 115
|
Posted: Sun Feb 04, 2018 5:59 pm Post subject: |
|
|
Thanks this is what I needed, cheers.
|
|
Back to top |
|
|
|