Fixed type error
This commit is contained in:
parent
c4508def1a
commit
2fb03f3bb1
|
@ -42,7 +42,7 @@ end
|
||||||
local function waitForStation(stationName)
|
local function waitForStation(stationName)
|
||||||
while true do
|
while true do
|
||||||
local event, side, channel, replyChannel, msg, dist = os.pullEvent("modem_message")
|
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
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -51,7 +51,7 @@ end
|
||||||
local function listenForAnyStation()
|
local function listenForAnyStation()
|
||||||
while true do
|
while true do
|
||||||
local event, side, channel, replyChannel, msg, dist = os.pullEvent("modem_message")
|
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)
|
os.queueEvent("rail_station_nearby", msg, dist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -79,7 +79,7 @@ local function waitForModemMessage(expectedReplyChannel, timeout)
|
||||||
function ()
|
function ()
|
||||||
while true do
|
while true do
|
||||||
local event, side, channel, replyChannel, msg, dist = os.pullEvent("modem_message")
|
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 = {}
|
||||||
data.channel = channel
|
data.channel = channel
|
||||||
data.replyChannel = replyChannel
|
data.replyChannel = replyChannel
|
||||||
|
|
Loading…
Reference in New Issue