Jump to content

Turtle retaining programs

turtle lua

2 replies to this topic

#1 Fudge26

  • New Members
  • 2 posts

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.

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,088 posts
  • LocationTasmania (AU)

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.

#3 Fudge26

  • New Members
  • 2 posts

Posted 18 December 2015 - 10:50 AM

Thank you for the assistance, rebooting the turtle fixed the problem

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users