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

Starting a program from a specific line?

Started by Cainite, 27 July 2014 - 06:31 AM
Cainite #1
Posted 27 July 2014 - 08:31 AM
Is that possible (and what would the code to do it be)?
As in, I say (in code and whatnot): ProgramX, run from line 32!
And it runs ProgramX, starting at line 32.

For context, I'm trying to get my Tree Farm program to resume after quitting and restarting the game, by having it save how far along it's gotten after each important step (to a separate file/value/variable etc), then using that to know what line to restart at.

I'm fairly new to CC/Lua/programming, using this mod to teach myself the basics, so sorry if I'm asking something that should be obvious.
Edited on 27 July 2014 - 06:41 AM
Yevano #2
Posted 27 July 2014 - 04:08 PM
I discussed a better way of doing something like this before. Basically, you could run the steps in functions and resume at the desired function at a later time. Have a look at this post.
Edited by
Cainite #3
Posted 30 July 2014 - 04:04 AM
Thanks, that actually looks really useful in future, I'll be saving that link for a later date. But, I've realized I can't just jump back into my program the way I was planning to, not at my skill level.
I appreciate the response, though!