Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function initNetwork(protocol, localID)
- rednet.host(protocol, localID)
- end
- local function handleIncomingMessages()
- while true do
- local senderId, message = rednet.receive(PROTOCOL)
- print("Received message:", textutils.serialize(message))
- end
- end
- local function initiateUpdate(nodes)
- for hostName, node in pairs(nodes) do
- rednet.send(nodeIDs[hostName], { type = "update" }, PROTOCOL)
- end
- print("Update initiated for all nodes.")
- end
- return {
- initNetwork = initNetwork,
- handleIncomingMessages = handleIncomingMessages,
- initiateUpdate = initiateUpdate,
- }
Advertisement
Add Comment
Please, Sign In to add comment