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

Turtle retaining programs

Started by Fudge26, 18 December 2015 - 09:36 AM
Fudge26 #1
Posted 18 December 2015 - 10:36 AM
Hello Computer craft community.

I am having some trouble with my mining turtle.
I try to delete an old version of a program and give it a new one but it doesn't seem to completely delete the old program so when i go to run what I think is the new program it drags back the data from the old one and runs that generating the same errors.
I have no idea if this is a bug or something to do with the turtle being named.
Computer Craft Version: 1.74
Mod pack: FTB infinity evolved 2.0.2

If anyone has any info on the matter. It would help greatly.
Fudge26
Bomb Bloke #2
Posted 18 December 2015 - 10:40 AM
This may be related to scope.

When your turtle (or any other ComputerCraft system) boots, it sets up the main shell with its own custom environment table. Any global variables that get declared (by you, or shell itself) go into that table; and there they sit, until you either clear them out or reboot that device.

If you declare all variables as local to your script, then they'll automatically be discarded when it ends, as opposed to sticking around within the system's globals table.

If you're still having trouble, post a link to a paste of your script.
Fudge26 #3
Posted 18 December 2015 - 10:50 AM
Thank you for the assistance, rebooting the turtle fixed the problem