It is seeing the if statement as false and not printing “Works”. It does read the file and position[1] does equal “1”. There are no errors. Again this works in Windows but not on Mac. Same code, same Corona build.
position = {}
local i = 1
filePath = system.pathForFile( “data.txt”, system.DocumentsDirectory )
local file = io.open( filePath, “r” )
local contents = file:read( “*a” )
io.close( file )
local ylast = 130
for line in io.lines(filePath) do
position[i] = line
local t = display.newText( position[i], 15, ylast, nil, 30 );
t:setTextColor( 255, 255, 255 );
ylast = ylast + 20
i = i + 1
end
if position[1] == “1” then
local tt = display.newText( “Works”, 25, 800, nil, 50 );
tt:setTextColor( 255, 255, 255 );
end