This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Mackan90096's profile picture

[Question] New line from text on internet

Started by Mackan90096, 19 June 2013 - 12:43 AM
Mackan90096 #1
Posted 19 June 2013 - 02:43 AM
(Yes, I know it's a bad title.. But I couldn't think of anything better.)

So:

When I use the http.get("url") to get text from my site and I write it to a monitor, it gets it all on one line even though I have it like so:

This is a line.
This is a second line.

So, my question:

Why does it do that?
Can I fix it somehow?
And if I can fix it, how?

Thanks // Mackan90096
Engineer #2
Posted 19 June 2013 - 03:13 AM
Im not sure why it does that to be very honest.. But, you can easily fix it by doing something like this:

local resp = http.get("http://engineercoding.koding.com") -- My dutch site :P/>

local content = {}
if resp then
    for line in resp.readLine do
       table.insert(content, line)
    end
else
   print("Connection failed")
end
Mackan90096 #3
Posted 19 June 2013 - 05:14 AM
Im not sure why it does that to be very honest.. But, you can easily fix it by doing something like this:

local resp = http.get("http://engineercoding.koding.com") -- My dutch site :P/>/>

local content = {}
if resp then
    for line in resp.readLine do
       table.insert(content, line)
    end
else
   print("Connection failed")
end


Thanks! :)/>