What happens when a chunk with a turtle in it is unloaded?

Started by ToxicGLaDOS, Jul 26, 2023, 10:48 PM

Previous topic - Next topic
I can't seem to find any docs on what exactly happens when a turtle is unloaded. Is the current line of lua finished and then the program is stopped? The reason this matters is for building programs that can withstand chunk unloads. If it's possible for a chunk unloading to interrupt a program like this

handle = fs.open("my_file", "w")
handle.write("some data")
-- Chunk unloads
handle.close()

Then it seems like it would be impossible to write programs that can consistently work through an unload.

SamH

When a chunk is unloaded the turtle (or any computer) looses all information on what it is doing. I'm not sure if code execution abruptly ends or the current line gets finished, but for sure the turtle does not return to what it was doing when the chunk is loaded again.

You could probably use GPS to figure out where the turtle is and carry on building from their.