Jump to content




'End' expected (to close ' function')


  • You cannot reply to this topic
4 replies to this topic

#1 Kyahne

  • Members
  • 4 posts
  • LocationThe Nether around 24000, 62, 1296

Posted 29 June 2013 - 12:19 AM

Title - (Noob-CC-Coder) 'End' expected (to close ' function')

ok i am a noob at computercraft its the only thing in FTB that i couldn't use at all (excluding mining turtle excavate, and tunnel)
so i decided to learn. I have watched a bit of direwolf20 (2-3 seasons) and started using the wiki. But enough non-sense.

I tried to make myself a auto harvest/replant program that does not use bonemeal (all the ones i found do) and i got this error

Bios : 337 : [string "FarmBot"] :107 : 'end' expected (to close 'function' at line 5)

can some1 tell me how to fix or help me finish my code?

pastebin code here "vb4rkuQD"

P.S. How do you use spoilers?

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 29 June 2013 - 01:26 PM

Split into new topic.

#3 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 29 June 2013 - 02:30 PM

Spoiler

I compressed the code with for-loops and correct indentation:
Spoiler

So, you have to close a for-loop to with end. Otherwise Lua doesnt know what commands it should execute in the for-loop.

#4 Kyahne

  • Members
  • 4 posts
  • LocationThe Nether around 24000, 62, 1296

Posted 30 June 2013 - 02:05 AM

Thanx Engineer Close Topic Please!!!!

#5 albrat

  • Members
  • 162 posts
  • LocationA Chair

Posted 01 July 2013 - 03:38 AM

:) it sometimes needs an extra set of eyes. Like Engineer I also spotted the missing end statement after a few seconds...

Lua is pretty good at showing you where to look for an error.

Quote

Bios : 337 : [string "FarmBot"] :107 : 'end' expected (to close 'function' at line 5)

This tells us that at line 107 the end statement is trying to close the function at line 5. This means there is a missing end statement somewhere between line 107 and 5.

so if you scan your code from line 5 downwards, noting each opening statement and checking for the close of that statement... you will find the error by process of elimination. (indentation helps with this kind of error finding - start a statement on the same indentation as you finish it on)





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users