Please properly format your code the next time you ask a question, because it helps identify the problem and more people will try to help. You can use
this tool, which does it for you but it's better to do so while programming.
I just quickly formatted it for future use:
rednet.open("top")
local id, msg = rednet.receive()
print("msg: "..msg)
if msg:lower():find("true") then
print(msg:lower():find("true"))
redstone.setOutput("right", true)
shell.run("lights")
end
if msg:lower():find("false") then
print(msg:lower():find("false"))
redstone.setOutput("right", false)
shell.run("lights")
end
shell.run("lights")
Anyway, is shell.run("lights") used to restart the program? Because there's a high chance it causes a stack overflow (the ArrayIndexOutOfBoundsException you're seeing) by creating infinite recursion. If so, you should use a
while loop instead.