This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cptdeath58's profile picture

fs.writing multiple lines

Started by cptdeath58, 28 May 2014 - 03:49 PM
cptdeath58 #1
Posted 28 May 2014 - 05:49 PM
I have problem trying to get the fs.write() to write multiple lines…
I want it to do this
Spoiler

Pie = fs.open( "lol", "w" )
Pie.write( "Hello" )
Pie.write( "Good Bye" )
And after every possible way I know it ends up like this…
SpoilerHelloGoodbye

Thank you
MKlegoman357 #2
Posted 28 May 2014 - 06:00 PM
You can either add a new-line (\n) character at the end of each line:


file.write("First line\n")
file.write("Second line")

or you could use file.writeLine():


file.writeLine("First line")
file.writeLine("Second line")

Both above examples create exactly the same output. In fact, file.writeLine() is the same file.write() but it just adds a new-line character for you.
cptdeath58 #3
Posted 28 May 2014 - 06:01 PM
Thanks