File io and loop help

Well, here's the offending code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
        local path = system.pathForFile( "leveldata.txt", system.DocumentsDirectory )
        print(path)
        local levelLoading = { time = nil, spawn = nil, path = nil}
        for line in io.lines(path) do
                print(line)
                if i == 1 then
                        levelLoading.time = line
                        i = i +1
                elseif i == 2 then
                        levelLoading.spawn = line
                        i = i+1
                elseif i == 3 then
                        levelLoading.path = line
                        i = 1
                        print (levelLoading.time..levelLoading.spawn..levelLoading.path)
                        table.insert(levelTable,levelLoading)
                end
        end
        for i,v in ipairs(levelTable) do
                print("Entry: " ..i.. " is " ..v.time)
        end
views:1445 update:2011/9/28 9:01:40
corona forums © 2003-2011