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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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();

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

or

1
2
3
4
5
6
7
fh = io.open
 
while true do
        line = fh.read(fh)
        if not line then break end
        print (line)
        end
views:925 update:2011/11/10 9:30:09
corona forums © 2003-2011