Jump to content




[Question] New line from text on internet


  • You cannot reply to this topic
2 replies to this topic

#1 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 19 June 2013 - 01: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

#2 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 19 June 2013 - 02: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


#3 Mackan90096

  • Signature Abuser
  • 518 posts
  • LocationIn my basement.

Posted 19 June 2013 - 04:14 AM

View PostEngineer, on 19 June 2013 - 02:13 AM, said:

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! :)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users