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

startup:3:attempt to call nil

Started by ArronM, 17 March 2013 - 12:07 AM
ArronM #1
Posted 17 March 2013 - 01:07 AM
Error I get is: "startup:3:attempt to call nil"

Code:
http://pastebin.com/pgg0kPeY
Lyqyd #2
Posted 17 March 2013 - 07:09 AM
Split into new topic.

Try `turtle.drop()` instead.
1lann #3
Posted 17 March 2013 - 07:18 AM
Error I get is: "startup:3:attempt to call nil"

Code:
http://pastebin.com/pgg0kPeY
Try moving the while true do statement to the bottom of the program, so the drop function is above it, so the drop function is defined before the loop starts.
Anavrins #4
Posted 17 March 2013 - 10:39 AM
All source codes are read from top to bottom, here you're trying to call your drop() function before it has been defined.
You should try to get the habit to always define all your functions first, then do your main code after it.
And if I might add, instead of doing
turtle.select(1)
turtle.dropDown()
turtle.select(2)
turtle.dropDown()
...
...
turtle.select(16)
turtle.dropDown()

You should give "for" loops a try, like this
for slot = 1,16 do
turtle.select(slot)
turtle.dropDown()
end
32-ish lines shrunken to 4 ;)/>