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

New line while writing in other file.

Started by I_IblackI_I, 13 February 2013 - 07:29 AM
I_IblackI_I #1
Posted 13 February 2013 - 08:29 AM
Title: New line while writing in other file.
Hello i'm making a code that writes in another file and after alot of searching i made this

i = 16
file = fs.open("startup", "w")
file.write("shell.run(\"power\" i")
(((This is the place where I need a code to go to the next line in the file)))
file.write("print(\"hi\")")
file.close()
Hope you can help!
Lyqyd #2
Posted 13 February 2013 - 08:39 AM
file.write([[shell.run("power")]].."\n")

The [[ ]] are block quotes, and do not require or accept escaping inside them. The \n is the newline character.
remiX #3
Posted 13 February 2013 - 09:04 AM
or use file.writeLine('')