Added check for already deserialized messages.
This commit is contained in:
parent
118a692b3a
commit
683b61a640
@ -118,7 +118,11 @@ local function listenToMiners()
|
|||||||
while running do
|
while running do
|
||||||
local event, side, sendChannel, replyChannel, serialized, distance = os.pullEvent("modem_message")
|
local event, side, sendChannel, replyChannel, serialized, distance = os.pullEvent("modem_message")
|
||||||
print("")
|
print("")
|
||||||
local data = textutils.unserialise(serialized)
|
local data = nil
|
||||||
|
if not pcall(function() data = textutils.unserialise(serialized) end) then
|
||||||
|
print("Message already table, not deserializing.")
|
||||||
|
data = serialized
|
||||||
|
end
|
||||||
if data["token"] == TOKEN and data["recipient"] == HOST then
|
if data["token"] == TOKEN and data["recipient"] == HOST then
|
||||||
handleMessage(data["sender"], data["type"], data)
|
handleMessage(data["sender"], data["type"], data)
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user