This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
alby1's profile picture

bios:14: [string "routing"]:29: '<eof>' expected

Started by alby1, 14 January 2017 - 07:56 AM
alby1 #1
Posted 14 January 2017 - 08:56 AM
Hi!
I have a problem: I made my own lua program:


rednet.open("top")

while true do
		event, sender, message, dist = os.pullEvent("rednet_message")
		if message == "lake" then
				redstone.setOutput("right", true)
				print("Routing to lake station")
				redstone.setOutput("left", false)
				sleep(10)
				redstone.setOutput("left", false)
				redstone.setOutput("right", false)
				print("Done")
		else
				print(message .. " is invalid")
		end
		if message == "sea" then
		 redstone.setOutput("left", true)
		 print("Routing to Sea Station")
		 redstone.setOutput("right", false)
		 os.sleep(10)
		 redstone.setOutput("left", false)
		 redstone.setOutput("right", false)
		 print("Done")
		 else
				print(message .. " is invalid")
		end
	end
end

but an error keep coming up: bios:14: [string "routing"]:29: '<eof>' expected

Thank You
Alberto

P.S Ive been trying to google it for about 2 hours but couldn't find anything…
Bomb Bloke #2
Posted 14 January 2017 - 11:58 AM
Fix your indenting, and you'll see you've got more "end"s in there than you should have.
KidBrine #3
Posted 26 January 2017 - 09:33 PM
I've fixed, shortened, and re-indented the code for you


code below
rednet.open("top")
while true do
  event, sender, message, dist = os.pullEvent("rednet_message")
  if message == "lake" then
    rs.setOutput("right", true)
    print("Routing to lake station")
    rs.setOutput("left", false)
    sleep(10)
    rs.setOutput("left", false)
    rs.setOutput("right", false)
    print("Done")
  else
    print(message .. " is invalid")
  end
  if message == "sea" then
    rs.setOutput("left", true)
    print("Routing to Sea Station")
    rs.setOutput("right", false)
    sleep(10)
    rs.setOutput("left", false)
    rs.setOutput("right", false)
    print("Done")
  else
    print(message .. " is invalid")
  end
end