Posted 05 March 2013 - 02:31 AM
The error I get is "attempt to index ? (a nil value)" on line 6. Here is the code.
-Dark
function loadLevel()
player = nil
pieces = nil
local file = io.open("/pec/levels/"..level..".nfa","r")
local y = 1
local row = { }
for lines in file:lines() do
for x=1,#lines do
row[y][x] = lines:sub(x,x)
end
local char = row[y][x]
if char == "p" then
player = loadSprite("pec/player.nfa",x,y)
elseif char == "1" or char == "2" then
table.insert(pieces,loadSprite(piecesPaths[tonumber(char)]))
end
y = y + 1
end
file:close()
end
Thank you for your time-Dark