Added check for already deserialized messages.

This commit is contained in:
Harrison Deng 2021-05-07 16:05:18 -05:00
parent 118a692b3a
commit 683b61a640

View File

@ -118,7 +118,11 @@ local function listenToMiners()
while running do
local event, side, sendChannel, replyChannel, serialized, distance = os.pullEvent("modem_message")
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
handleMessage(data["sender"], data["type"], data)
else