Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --//Variables (this is a program to open the modem's chanel)
- local args = {...}
- local modemLocation = assert(args[1], "Usage: openChannel <Modem Location (Front/Back/Top/Bottom)> <Port#>")
- local channel = assert(tonumber(args[2]), "Usage: openChannel <Modem> <A number between 0 & 65535>")
- --//Start of program
- if channel >= 0 and channel <= 65535 then
- modem = peripheral.wrap(modemLocation)
- modem.open(channel)
- if modem.isOpen(channel) then
- print("The modem is now ready to operate in the selected channel:" ..channel ..".")
- print("")
- end
- return modem
- else
- print("The channel must be a number between 0 & 65535")
- print("The modem was not setup correctly, please try again")
- return nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement