My lights system is failing to launch properly.I am getting error every time I try to launch it and I can't seem to find the problem, but I guess it got to do something with functions.
Any help would be appreciated.
Here's to code:
on = "1"
off = "2"
menu()
function menu()
term.clear()
term.setCursorPos(1,1)
print(" +--------------+")
print(" :Lights Control:")
print(" +--------------+")
print(" :1.To turn ON. :")
print(" :2.To turn OFF.:")
print(" +--------------+")
write("Your Choice:")
input = read()
if input == on then on() end
elseif input == off then off()
else menu()
end
function on()
term.clearLine()
print("Lights are turning on")
rs.setOutput("left",true)
sleep(1)
menu()
end
function off()
term.clearLine()
print("Lights are turning on")
rs.setOutput("left",false)
sleep(1)
menu()
end
And here is the picture of the error:
Spoiler
Thank you.












