feat(net): stopServer function for net.listenQuery

This commit is contained in:
Guillaume ARM 2024-05-21 21:58:49 +02:00
parent 3f92309ac6
commit 5305afe203

View File

@ -15,9 +15,15 @@ net.listenQuery = function(hostname, processQueryMessage)
rednet.host(QUERY_PROTO, hostname)
while true do
local serverRunning = true
local function stopServer()
serverRunning = false
end
while serverRunning do
local computerId, message = rednet.receive(QUERY_PROTO)
local responseMessage = processQueryMessage(textutils.unserialize(message), computerId)
local responseMessage = processQueryMessage(textutils.unserialize(message), computerId, stopServer)
rednet.send(computerId, textutils.serialize(responseMessage), QUERY_RESPONSE_PROTO)
end