Well, here’s the offending code
[lua] 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[/lua]
No matter what I do, when I get to the loop to print out the time of all the items I’ve inserted into levelTable, it’s always the same. It seems as though the only reference I have in the levelTable is to the final levelLoading that I create. The text file I’m reading from is simply a 9 line file with a single digit on each line. I’m still sorta new to lua, so if someone could tell me how to do this so I’m not always referencing the same object that would be great! [import]uid: 75335 topic_id: 12624 reply_id: 312624[/import]