I have a text file that basically contains a bunch of lines like this;
15011000
16011007
01013500
01020001
13022210
14022000
05030570
01038004
all of the lines are the same length, 8 characters, and are all on their own, separate lines.
All I want to do is loop through each individual line in the file, and convert each line to a new string entry in an array, but I'm having trouble understanding how file is loaded, and how to copy just 1 line to a string. I read a lot of the manual, and came across love.filesystem.lines(), but I'm uncertain how it works. The example the documentation gave was just
Code: Select all
local highscores = {}
for line in love.filesystem.lines("highscores.lst") do
table.insert(highscores, line)
end
Assuming 'line' in the example is the number of lines in the file, I feel like the solution would be something like
Code: Select all
for line in love.filesystem.lines(file) do
array[line] = (string loaded from love.filesystem.lines())
end