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

Can i save my text in a other program

Started by Nullname123, 08 August 2014 - 04:05 PM
Nullname123 #1
Posted 08 August 2014 - 06:05 PM
I don´t know how I can make a programm that saves my text I write in a new file or programm it should work like an archive


example of the code


login program – not inportant

while true do
local input = read()

term.write("Attack plan")
term.setCursorPos(1,2)
who:
term.setCursorPos(6.2)
and so on

but how can I save it in an other programm ?
Edited on 08 August 2014 - 05:20 PM
kornichen #2
Posted 08 August 2014 - 08:36 PM
I don't know what you exactly mean - maybe you could be a little bit more specific next time.

If you want to save the inputs you make in this line

local input = read()
you could put this above the while loop

local file = fs.open("yourfilename", "w") -- "w" becaues you want to write into the file
and this directly below the line where you use read()

file.writeLine(input)
But please remember to close the file after writing with

file.close()
If you don't do that your file won't be saved!
Nullname123 #3
Posted 09 August 2014 - 07:54 AM
yeah thanks a lot works great exatly what I wan`t