hi,
i have this problem when i save my number of level in a textfile my function start don’t work and an another thing is that the terminal output of my corona simulator restarts when i save my data in my textfile…
local path = system.pathForFile( "myfile.txt", system.RessourceDirectory ) local file = io.open( path, "r" ) var = file:read( "\*a" ) io.close( file ) file = nil local cntLevel=tonumber(var) local function upgrade() cntLevel=cntLevel+1 if cntLevel \>= #level then print("you have finished the game…hourra!") cntLevel = #level else --save data in text file saveData = cntLevel file = io.open( path, "w" ) file:write( saveData ) io.close( file ) file = nil flagupgradelevel=true local function startLevel() print("start") end timer.performWithDelay(2000,startLevel) end end --result nothing and my terminal output restart but the file is correctly saved
by against when i don’t save my data my function works
local function upgrade() cntLevel=cntLevel+1 if cntLevel \>= #level then print("you have finished the game…hourra!") cntLevel = #level else local function startLevel() print("start") end timer.performWithDelay(2000,startLevel) end end --result : start
what’s the problem with this function yet I followed the documentation…
thanks for your help
