Posted 18 September 2013 - 02:23 AM
Hello. This is the first issue I've run into where I can't find a work-around or an answer already posted. Hence, this is the first time I'm posting, even though I use this all the time.
My error is an attempt to call nil; however, it's not usual. I get this error when I type in the root(?) directory "edit boot"
edit:50: attempt to call nil
This error goes away temporarily when I restart the turtle. But so do all my functions and variables.
boot is the temporary name of a program I'm making to install a significantly larger set of programs on all my construction turtles, from a disk drive. I will later change the program's name to something talking about installation. And boot will be reused as the temporary name of the initialization file, which will be moved to startup. This program currently named boot will be used for other program-set installations as well. Currently, I only have it set up to confirm the disk drive and floppy disk name.
The edit:50: error occurs when I try to edit my program before resetting and after it is successfully run with the variable 'peri' set to whatever side the drive is on. I can still copy the program to a new name. And… the exact circumstances of the error keep changing. Now it's triggering when I tell it that it's not the right disk(hit a key that's not 'y').
I'm pretty sure that the error lies somewhere with one of my variables. I'm just not sure which one, and how to fix it. The code for the boot program follows.
My error is an attempt to call nil; however, it's not usual. I get this error when I type in the root(?) directory "edit boot"
edit:50: attempt to call nil
This error goes away temporarily when I restart the turtle. But so do all my functions and variables.
boot is the temporary name of a program I'm making to install a significantly larger set of programs on all my construction turtles, from a disk drive. I will later change the program's name to something talking about installation. And boot will be reused as the temporary name of the initialization file, which will be moved to startup. This program currently named boot will be used for other program-set installations as well. Currently, I only have it set up to confirm the disk drive and floppy disk name.
The edit:50: error occurs when I try to edit my program before resetting and after it is successfully run with the variable 'peri' set to whatever side the drive is on. I can still copy the program to a new name. And… the exact circumstances of the error keep changing. Now it's triggering when I tell it that it's not the right disk(hit a key that's not 'y').
I'm pretty sure that the error lies somewhere with one of my variables. I'm just not sure which one, and how to fix it. The code for the boot program follows.
1.----Confirm Disk to Install----
2.
3.i=1
4.peri = "blah"
5.io = nil
6.while io ~= "y" and peri ~= nil do
7. peri = peripheral.getNames()[i]
8. if peripheral.getType(peri) == "drive" then
9. print("Is \""..disk.getLabel(peri).."\" what you wish to download?")
10. print("Any character but \"y\" will return a negative response.")
11. temp, io = os.pullEvent("char")
12. end
13. if peri == "right" then
14. print("No (more) Valid Drives")
15. end
16. i = i+1
17.end
18.
19.----Download Programs----
20.
21.
22.----Install----