From 2fb03f3bb1e70e2a4ad58dafd18e2f5e80acc001 Mon Sep 17 00:00:00 2001 From: andrewlalis Date: Fri, 15 Sep 2023 09:23:36 -0400 Subject: [PATCH] Fixed type error --- router.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/router.lua b/router.lua index 35fafe0..fa21577 100644 --- a/router.lua +++ b/router.lua @@ -42,7 +42,7 @@ end local function waitForStation(stationName) while true do local event, side, channel, replyChannel, msg, dist = os.pullEvent("modem_message") - if channel == STATION_BROADCAST_CHANNEL and isValidStationInfo(msg) and msg.name == stationName and msg.range >= dist then + if type(channel) == "number" and channel == STATION_BROADCAST_CHANNEL and isValidStationInfo(msg) and msg.name == stationName and msg.range >= dist then return end end @@ -51,7 +51,7 @@ end local function listenForAnyStation() while true do local event, side, channel, replyChannel, msg, dist = os.pullEvent("modem_message") - if channel == STATION_BROADCAST_CHANNEL and isValidStationInfo(msg) and msg.range >= dist then + if type(channel) == "number" and channel == STATION_BROADCAST_CHANNEL and isValidStationInfo(msg) and msg.range >= dist then os.queueEvent("rail_station_nearby", msg, dist) end end @@ -79,7 +79,7 @@ local function waitForModemMessage(expectedReplyChannel, timeout) function () while true do local event, side, channel, replyChannel, msg, dist = os.pullEvent("modem_message") - if replyChannel == expectedReplyChannel then + if type(replyChannel) == "number" and replyChannel == expectedReplyChannel then data = {} data.channel = channel data.replyChannel = replyChannel