How to append data in a text file?

Hello,

Here is what I found on saving a data file. How can I add lines to this on the next line?

Thanks

local saveData = "My app state data" local path = system.pathForFile( "myfile.txt", system.DocumentsDirectory ) local file = io.open( path, "w" ) file:write( saveData ) io.close( file ) file = nil

Hi! 

Look at io.open() “a” (append) option in the sdk.

Thanks, I read that now on the site. But will it get appended to a new line? Or added to the existing line? I need data appended as a new line.

Thanks!

Data is appended at the end of file so it will be a added character after character. You must write end of line yourself.

Hi! 

Look at io.open() “a” (append) option in the sdk.

Thanks, I read that now on the site. But will it get appended to a new line? Or added to the existing line? I need data appended as a new line.

Thanks!

Data is appended at the end of file so it will be a added character after character. You must write end of line yourself.