Posted 21 January 2013 - 11:58 AM
This program is just supposed to be a menu that runs other rednet related programs when the user selects an option. When I run it I get the error:
bios:338: [string "rednet"]:35: 'then' expected
this is the code
bios:338: [string "rednet"]:35: 'then' expected
this is the code
term.clear() --this first part is just text
term.setCursorPos(1,1)
print("Welcome to RedNet!")
print("Please select an action.")
print("")
print("1. Receive")
print("2. Send Message")
print("3. Broadcast Message")
print("4. Configure Modem")
print("5. Announce")
print("")
write("Perform action ")
local input = read() -- this part is suppose to run the corresponding programs
if input == "1" then
shell.run(netreceive) -- these are the programs that correspond to each option
end -- is there suppose to be an "end" after each if?
if input == "2" then
shell.run(netsend)
end
if input == "3" then
shell.run(netbroadcast)
end
if input == "4" then
shell.run(netset)
end
if input == "5" then
shell.run(netannounce)
end
if input ~= "1","2","3","4","5" then -- i have no idea if i did this line correctly
print("Please enter a valid option.")
sleep(2)
shell.run(rednet) -- this is just to restart the program in the event of an invalid input
end