Hi,
I’m trying to create text and write it to a file using the following code.
local function msg( ... ) local str = tostring(arg[1]) for i = 2, #arg do str = str .. "\n" .. tostring(arg[i]) end return str end local saveData = msg("test", "test 2", "test 3") local path = system.pathForFile( "test.txt", system.DocumentsDirectory ) local file, errorString = io.open( path, "a" ) if not file then print( "File error: " .. errorString ) else file:write( saveData ) io.close( file ) end file = nil
The code works great but once I build the app the \n within the text file doesn’t actually break the text it just shows as a \n…?
Is there a way to fix this so when the app exports the .txt file it actually has a break in the text?
Thanks,
-B