In the simulator it works perfectly. The error appears on the ipad.
–Runtime error
–line 11185: attempt to index global “file” (a nil value)
function Leer (event)
path = system.pathForFile( “Preferencias.txt” )
file = io.open( path, “r” )
CadenaPreferencias= file:read("*a")
io.close( file )
VP1=(string.sub(CadenaPreferencias, 1, 1))
VP2=(string.sub(CadenaPreferencias, 2, 2))
VP3=(string.sub(CadenaPreferencias, 3, 3))
VP4=(string.sub(CadenaPreferencias, 4, 4))
VP7=(string.sub(CadenaPreferencias, 5, 5))
end
function Escribir (event)
CadenaPreferencias=(VP1…VP2…VP3…VP4…VP7)
path = system.pathForFile( “Preferencias.txt” )
file = io.open( path, “w” )
file:write(CadenaPreferencias)
io.close( file )
end
– the line with red text is line 11185
Its a scope problem?