Make the UID return hopefully actually work
This commit is contained in:
parent
cd6a4fc08d
commit
c15d4a26a0
@ -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
|
||||
|
6
util.lua
6
util.lua
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user