feat(net): add openRednet and closeRednet utils
This commit is contained in:
parent
4f16cef9f5
commit
cfea9f575f
10
libs/net.lua
10
libs/net.lua
@ -10,6 +10,16 @@ local function assertRednetIsOpened()
|
||||
end
|
||||
end
|
||||
|
||||
net.openRednet = function(modem)
|
||||
modem = modem or peripheral.find("modem") or error("No modem attached", 0)
|
||||
return rednet.open(peripheral.getName(modem))
|
||||
end
|
||||
|
||||
net.closeRednet = function(modem)
|
||||
modem = modem or peripheral.find("modem") or error("No modem attached", 0)
|
||||
return rednet.close(peripheral.getName(modem))
|
||||
end
|
||||
|
||||
net.listenQuery = function(hostname, processQueryMessage)
|
||||
assertRednetIsOpened()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user