Jump to content




Function Not working?


  • You cannot reply to this topic
1 reply to this topic

#1 raysilverstone

  • New Members
  • 2 posts

Posted 30 November 2013 - 09:23 PM

I'm trying to learn Lua and I think I have a basic understanding so far. My Problem is that I can't figure out why my program is giving this error. I've traced back the function and it all seems right. I've modified a tunnel program to make paths. I used some of the code made by HuskyBlueFire. Any help would be great. When I run the program it gives me this error:
DiggyPath:652: attempt to call nil
Here is the pastebin link to my code.
http://pastebin.com/dMXRtGtm

#2 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 30 November 2013 - 10:36 PM

Notice how the "moveForward()" and "moveBack()" functions are both missing an "end", but "removeXChest()" and "removeIChest()" have an extra one each?

This means that the bulk of your function declarations are inside the "moveForward()" function. As far as Lua is concerned, those encapsulated functions don't exist until that function has been called (which causes it to process those extra declarations).

Anyhow, move those "end"s and give it another shot.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users