Posted 05 January 2013 - 07:32 AM
Greetings,
Here's the bit of code I'm using:
Here's the contents of "message1.txt":
Now, when running this program I see the above message appear perfectly on the computer screen, but the monitor screen shows it like this:
It seems for some reason new lines are being replaced with question marks. I'm not sure if this is because of the file, the HTTP API, or me just using this all wrong. Can anyone point me in the right direction? Cheers.
Here's the bit of code I'm using:
monitor = peripheral.wrap("right")
while true do
for i = 1, 3 do
local url = "http://www.aliasprojects.net/mc/message" .. i .. ".txt"
while true do
http.request(url)
event, url, file = os.pullEvent()
if event == "http_success" then
monitor.clear()
monitor.setCursorPos(1, 1)
txt = file.readAll()
print(txt)
monitor.write(txt)
sleep(10)
break
end
end
end
end
Here's the contents of "message1.txt":
Welcome to our server!
Please read the following messages:
Now, when running this program I see the above message appear perfectly on the computer screen, but the monitor screen shows it like this:
Welcome to our server!??Please read the following:
It seems for some reason new lines are being replaced with question marks. I'm not sure if this is because of the file, the HTTP API, or me just using this all wrong. Can anyone point me in the right direction? Cheers.