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

Read http line by line

Started by theeboris, 28 December 2013 - 12:12 PM
theeboris #1
Posted 28 December 2013 - 01:12 PM
Hello,

Today I was making a http browser for computercraft. But I have a little problem. I don't know how I can read everything I get line by line. To make everything clear a small explanation. If I have this file:

Hey :D/>
This is my first website.
Nice, isn't it?
Normally I get the whole text, but I want to read it line by line.
I hope somebody can help me.

Thanks :D/>
gollark8 #2
Posted 28 December 2013 - 01:51 PM
I think this should work.

local handle = http.get(url) -- or fs.open(file)
local line = handle.readLine()
--do some stuff with line
handle.close()
Edited on 28 December 2013 - 01:02 PM
theeboris #3
Posted 28 December 2013 - 02:25 PM
Thanks :D/> It works :)/> I was stupid :P/> Forgot capital