Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
Twitchi

why does it want an extra end?

Question

Hey guys, I have been learning Lua recently and have ran into a bit of an issue, every time I try to run the code bellow I get an error (missing end to close function) but no matter how many times I look at it, I see an end closing the function..
I'm sure I have made a massive error I just can't see it for all the looking


 

function walk()
  local clear = robot.detect()
    if clear == true then       -- if block forward
        while clear == true do -- while it is true
        local upClear = robot.detectUp()
          if upClear == true then
            robot.up()           -- fly up
            clear = robot.detect()--check forward again
          else if upClear == false then
            clear = false
          end --upclear
        end --while
    end --block forward
  robot.forward()   --no obstical move forward

    local clearDown = robot.detectDown()  --Check for ledge
      while clearDown == false do
        robot.down()
        clearDown = robot.detectDown()
      end -- while
end -- function

any help is much appreciated as no amount of googling can find me an answer

also full paste if needed http://pastebin.com/5MEB99V5

Link to post
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.