Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- Program : Connect a sgcraft gate to another
- --- Author : LightKnight51
- --- Last modification : 23/04/2021
- --- Functions
- local arg = { ... }
- function askConnectionType()
- connectionType = ""
- if arg[1] ~= nil then
- connectionType = arg[1]
- print("Type de connexion : " .. connectionType)
- else
- connectionType = read()
- end
- return connectionType
- end
- function askAddress()
- address = ""
- if arg[2] ~= nil then
- address = arg[2]
- print("Adresse en paramètre : " .. address)
- else
- address = read()
- end
- return address
- end
- function mainProgram()
- connectionType = askConnectionType()
- sg = peripheral.find("stargate")
- if connectionType == "connect" or connectionType == "con" then
- address = askAddress()
- sg.dial(address)
- elseif connectionType == "disconnect" or connectionType == "dis" then
- sg.disconnect()
- end
- end
- mainProgram()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement