Make the UID return hopefully actually work

This commit is contained in:
osmarks 2018-05-06 08:18:49 +01:00
parent cd6a4fc08d
commit c15d4a26a0
2 changed files with 4 additions and 5 deletions

View File

@ -138,9 +138,8 @@ function processRequests()
local ok, r = pcall(processRequest, msg)
if not ok then r = "ERROR" end
if ok and r then r.uid = msg.uid end
rednet.send(id, r, "dragon")
rednet.send(id, { msg = r, uid = msg.uid }, "dragon")
end
end
end

View File

@ -23,12 +23,12 @@ local errors = {
local function query(m)
local uid = math.random(0, 1000000000)
m.uid = uid
local msg
local resp
repeat
rednet.broadcast(m, "dragon")
_, msg = rednet.receive("dragon", 1)
until msg and msg.uid == uid
return msg
until resp and resp.msg and resp.uid == uid
return resp.msg
end
-- Fetches an item with the given display name in the given quantity.