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

Ignore, user error

Started by Heliomance, 31 January 2015 - 12:44 PM
Heliomance #1
Posted 31 January 2015 - 01:44 PM
I'm trying to run the following program:
while true do
	event, param1 = os.pullEvent()
	if event = "redstone" then
		if param1 = "left" or param1 = "top" then
			if redstone.getInput("left") = true and redstone.getInput("top") = true then
				redstone.setBundledOutput("right", colors.yellow)
				sleep(0.5)
				redstone.setBundledOutput("right", 0)
			elseif redstone.getInput("left") = false and redstone.getInput("top") = false then
				redstone.setBundledOutput("right", colors.magenta)
				sleep(0.5)
				redstone.setBundledOutput("right", 0)
			end
		end
	end
end

Every time I try, I get this error:
bios: 339: [string "startup"]: 3: 'then' expected

There's definitely a "then" in line 3, so I'm not sure what it's complaining about. Ideas?

EDIT: Never mind, I'm an idiot. Just noticed I was using = instead of ==.
Edited on 31 January 2015 - 12:52 PM
InDieTasten #2
Posted 31 January 2015 - 01:49 PM
to check wether something is equal you need to use == instead of =, which would be an assignment