Refactor GetChannelId out of FindOrJoinChannel
No reason for it to be nested
This commit is contained in:
@@ -13,7 +13,6 @@ function shared.Messenger.Init()
|
||||
---@type table<string, number>
|
||||
local channelIdMap = {}
|
||||
|
||||
local function FindOrJoinChannel(channelName, password)
|
||||
local function GetChannelId(channelName)
|
||||
local channels = { GetChannelList() }
|
||||
for i = 1, #channels, 2 do
|
||||
@@ -25,6 +24,7 @@ function shared.Messenger.Init()
|
||||
end
|
||||
end
|
||||
|
||||
local function FindOrJoinChannel(channelName, password)
|
||||
local channelId = GetChannelId(channelName)
|
||||
if not channelId then
|
||||
print("Channel", tostring(channelName), "not found, joining")
|
||||
@@ -48,7 +48,7 @@ function shared.Messenger.Init()
|
||||
end
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
if not shared.messenger then shared.messenger = {} end
|
||||
if not shared.messenger.queue then shared.messenger.queue = {} end
|
||||
if not shared.messenger.ticker then
|
||||
|
Reference in New Issue
Block a user