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

Is it possible to make an program with custom code while still running a program's code?

Started by NunoLava1998, 20 October 2015 - 06:29 AM
NunoLava1998 #1
Posted 20 October 2015 - 08:29 AM
In ComputerCraft 1.7.4, is it possible to make a program that creates a program with code but it's still running the original program's code so when it's finished i can display on a monitor something? (The code i use for the monitor is "monitor = peripheral.wrap("top"), just a note. )
So if people are not understanding this, then this is what it is like in Batch (scripting language used in CMD.):
echo We're adding something to a example log. >> 123.log (If there's no thing named 123.log, it creates the file, just like the edit file.)
Bomb Bloke #2
Posted 20 October 2015 - 12:16 PM
Whenever one script executes another, the first stays loaded in memory and resumes from where it left off when the second finishes. This is much the same as what happens when you call any "regular" function.

You can use fs.open() to deal with files external to your main script. Eg:

local myFile = fs.open("123.log", "a")
myFile.writeLine("We're adding something to an example log.")
myFile.close()