Reading text file, until space

Hi there,
I am wondering how to read a text file until you reach a space (are they called brakes?) in which it then prints that.

Here’s what i have so far:

local function main()  
 local vstart = {}  
 local vend = {}  
  
 local path = system.pathForFile( "gti.txt", "C:\\Users\\Family\\Desktop\\" ) -- dont worry about that being wrong in the future.  
 local fh = io.open( path )  
   
 for line in fh:lines() do  
 print( line ) -- display the line in the terminal  
 end  
  
 fh:close()  
  
  
end  
main();  

That does an entire line and prints that.

My text file is like this in format:
Start End

111111 111111  
222222 222222  
333333 333333  
...  

My aim is to read each text chunk (until space) write it into a table.
Then write a print statement like this print the first chunk into the first area and the second chunk into the 2nd area.
then increase.
Like this. :

if i \< 100 then  
print("Your time started at:" {1})  
print("Your time ended at:" {2})  
  
vstart = vstart +1  
vend = vend +1  
end  

Hopefully thats not too confusing?

Thanks in advance

[import]uid: 91798 topic_id: 17448 reply_id: 317448[/import]

http://www.evilmana.com/tutorials/lua_tutorial_09.php

or

[code]
fh = io.open

while true do
line = fh.read(fh)
if not line then break end
print (line)
end
[/code] [import]uid: 24 topic_id: 17448 reply_id: 66130[/import]