Jump to content




startup:3:attempt to call nil


3 replies to this topic

#1 ArronM

  • New Members
  • 1 posts

Posted 17 March 2013 - 01:07 AM

Error I get is: "startup:3:attempt to call nil"

Code:
http://pastebin.com/pgg0kPeY

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 17 March 2013 - 07:09 AM

Split into new topic.

Try `turtle.drop()` instead.

#3 1lann

  • Members
  • 516 posts
  • LocationSeattle

Posted 17 March 2013 - 07:18 AM

View PostArronM, on 17 March 2013 - 01:07 AM, said:

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.

#4 Anavrins

  • Members
  • 775 posts

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 ;)





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users