Posted 06 December 2013 - 10:13 AM
Hello all
I want to make a news program that reads text from my website. and prints it onto the screen.
my program prints the text to the screen like i want.
But i want it to wait for an update in the website and update the text after that.
If i compare the old text from the website and the new text from the website. it says the new text it has been looking for is different than the old one.
even though nothing changed
if i do
Then it says TABLE and after that some numbers and letters in stead of the text from the website.
Could anyone please help me with this and tell to me what I'm doing wrong in this code?
I want to make a news program that reads text from my website. and prints it onto the screen.
my program prints the text to the screen like i want.
But i want it to wait for an update in the website and update the text after that.
If i compare the old text from the website and the new text from the website. it says the new text it has been looking for is different than the old one.
even though nothing changed
if i do
write(header2.readAll())
Then it says TABLE and after that some numbers and letters in stead of the text from the website.
Could anyone please help me with this and tell to me what I'm doing wrong in this code?
Spoiler
function timer(time)
repeat
term.setCursorPos(1,15)
print(time.." Seconds left before refresh")
sleep(1)
time = time - 1
until time < 1
end
while true do
term.clear()
term.setCursorPos(1, 1)
header = http.get("http://www.lua.net84.net/luabestanden/header")
text = http.get("http://www.lua.net84.net/luabestanden/text")
mon = peripheral.wrap("top")--
write(header.readAll())
write("\n\n")
write(text.readAll())
write("\n")
while true do
header2 = http.get("http://www.lua.net84.net/luabestanden/header")
if header.readAll == header2.readAll then
term.setCursorPos(1, 8)
term.clearLine()
print("same")
else
term.setCursorPos(1, 8)
term.clearLine()
print("different")
end
end
--timer(10)
end