Posted 08 April 2013 - 06:00 PM
                I'm trying to make a little program that allows me to type in a number, which then opens a port on my modem == to that number. This is what I have so far. 
It asks you to enter a port. Then asks you if you want to connect to that port, displaying the port you entered with print() and then if you type Y then it tries to do a modem.open with that variable. The issue is it returns "connect:9: Expected number" if I was to instead do modem.open(…address…) it says "unexpected symbol"
This is mostly an exercise in using variables and modem stuff.
                
            
while true do
  term.clear()
  term.setCursorPos(1, 1)
  print("Enter Port:")
  local address = read()
  print("Connect to "..address.."? y/n")
  local answer = read()
  if answer == "y" then
    modem.open('..address..')
  end
end
It asks you to enter a port. Then asks you if you want to connect to that port, displaying the port you entered with print() and then if you type Y then it tries to do a modem.open with that variable. The issue is it returns "connect:9: Expected number" if I was to instead do modem.open(…address…) it says "unexpected symbol"
This is mostly an exercise in using variables and modem stuff.
 
         
                