Added check to see if unserializing is necessary.
This commit is contained in:
parent
6f94e81ca1
commit
e6d75af1f7
@ -425,7 +425,11 @@ local function listen()
|
|||||||
print("Listening for directives...")
|
print("Listening for directives...")
|
||||||
local event, side, sendChannel, replyChannel, serialized, distance = os.pullEvent("modem_message")
|
local event, side, sendChannel, replyChannel, serialized, distance = os.pullEvent("modem_message")
|
||||||
print("Recieved data...")
|
print("Recieved data...")
|
||||||
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"] == UNIT and data["type"] == REQUEST then
|
if data["token"] == TOKEN and data["recipient"] == UNIT and data["type"] == REQUEST then
|
||||||
print("Got request: " .. data["request"])
|
print("Got request: " .. data["request"])
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user