hi i am taking info from a data.txt file, so if i read the entire document when i pass the optionLine to the bg it works but if i try to read line by line the txt document it do not work…the wired thing is that on the simulator it works perfectly but on the device display an from director only when i get the optionLine reading the file line by line
[lua]function readFile(filename)
local data;
local path = system.pathForFile( filename)
local file = io.open( path, “r” );
if file then
data = file:read( “*a” )
io.close( file )
end
return data
end
–== read by lines===----
function readFileLines(filename,number)
local data;
local path = system.pathForFile(filename)
local fh = io.open( path , “r” )
local t=1;
for line in fh:lines() do
–print(“t: “,t,” line:”,number)
if(t==number)then
data = tostring(line);
print(lines)
end
t=t+1
end
io.close( fh )
return data
end
optionLine = file.readFileLines(“data.txt”,1)
local bg = display.newImage(optionLine);
localGroup:insert(fondo);[/lua] [import]uid: 138440 topic_id: 33884 reply_id: 333884[/import]
thanks for the idea [import]uid: 138440 topic_id: 33884 reply_id: 134747[/import]