I’m trying to create a simple lobby-like setup, where someone will create a lobby and wait for players to join before starting the game. I’m using Authoritative matches for this.
As a workaround to my previous attempt, I tried to simply add the notification immediately after creating the match. My test notification code is like this
nk.notification_send("76a147a1-68e5-4da1-aeb9-a8a6d0d89107", "New match", nk.match_get(matchid), OpCodes.new_match_notification, nil, false) for _, match in ipairs(nk.match_list()) do nk.logger_info(string.format("List all Matches - Match id %s", match.match_id)) end
Effectively every time a match is created, I want all logged-in users to receive the list of all currently available matches.
I’m running into two issues
- When the
nk.match_list()is run immediately after creating a match, it does not yet “see” the new match and therefore does not return it in its table results. I also found no API to “sleep” for a millisecond or somethign to allow the match creation to finalize.
- I don’t see a way to loop through all currently logged in users, or all users for that matter. Is there such a method?