Advertisement
Raphsod

openChannel

Dec 5th, 2022 (edited)
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.70 KB | None | 0 0
  1. --//Variables (this is a program to open the modem's chanel)
  2. local args = {...}
  3. local modemLocation = assert(args[1], "Usage: openChannel <Modem Location (Front/Back/Top/Bottom)> <Port#>")
  4. local channel = assert(tonumber(args[2]), "Usage: openChannel <Modem> <A number between 0 & 65535>")
  5.  
  6. --//Start of program
  7. if channel >= 0 and channel <= 65535 then
  8.     modem = peripheral.wrap(modemLocation)
  9.     modem.open(channel)
  10.     if modem.isOpen(channel) then
  11.         print("The modem is now ready to operate in the selected channel:" ..channel ..".")
  12.         print("")
  13.     end
  14.     return modem
  15. else
  16.     print("The channel must be a number between 0 & 65535")
  17.     print("The modem was not setup correctly, please try again")
  18.     return nil
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement