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
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.
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