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

attempt to index ? (a nil value)

Started by jaxsshadow, 10 January 2013 - 12:30 PM
jaxsshadow #1
Posted 10 January 2013 - 01:30 PM
well im really new to computer craft tried to start up some turtles and made a start up disck that compounded this with the start up for rednet that i made and i got the error "attempt to index ? (a nil value) " on line six from this

fs.copy("disk/dark","dark")
rednet.open("right")
print("my name is")
x=os.computerID()
print(x)
turtle.forward()
shell.run("dark")




help wil be well appreciated
theoriginalbit #2
Posted 10 January 2013 - 01:33 PM
firstly this forum has [code][/code] tags… it makes code look nicer :)/>

now stupid question, but it has to be checked, this is on a turtle yes?
crazyguymgd #3
Posted 10 January 2013 - 01:36 PM
my guess is you have a typo in the code that's actually on your turtle.
make sure it's actually turtle.forward() with no spelling mistakes. You typed it correctly here though.
jaxsshadow #4
Posted 10 January 2013 - 01:53 PM
no its on a floppy and the error is from the computer
theoriginalbit #5
Posted 10 January 2013 - 01:55 PM
the error is because a computer can not use the turtle api. its not a turtle, it cant move. so it doesn't know what to do with turtle.forward(). if you put it on a turtle it will work.
jaxsshadow #6
Posted 10 January 2013 - 01:57 PM
it is also spelled correctly
theoriginalbit #7
Posted 10 January 2013 - 01:59 PM
it doesn't matter if its spelled correctly or not if it doesn't exist. a computer CANNOT do turtle things!
jaxsshadow #8
Posted 10 January 2013 - 02:03 PM
ok thanks also does it ever matter what kind of floppy
theoriginalbit #9
Posted 10 January 2013 - 02:05 PM
no a floppy is just a storage medium that goes into a disk drive. the disk drive can be accessed by any computer/turtle beside it.
jaxsshadow #10
Posted 10 January 2013 - 02:06 PM
thanks sorta fell like a dumbass
ChunLing #11
Posted 10 January 2013 - 09:10 PM
Don't worry about it. I mean, yeah, putting a turtle API command on a computer makes so little sense that I didn't even consider the possibility, but there isn't any way you would really know that computers don't even have access to the turtle API unless you'd read the API or had tried loading it on a computer (or looked up the value of type(turtle) in lua or another program).

Before I looked at the API, I would have assumed that a turtle API function would just fail on a computer and give a false/nil return.