Passing query property from matchmaking to the match create module

My game using matchmaking to match players together pased on their highest map they unlocked using a query proparaty called top_map

After the matchmaking find enough players it generate a match using this lua module

local nk = require(“nakama”)

local function makematch(context, matched_users)
local top_map = context. query_params[“top_map”]

local modulename = “world_control”
local setupstate = { invited = matched_users, top_map = top_map }
local matchid = nk.match_create(modulename, setupstate)

return matchid
end

nk.register_matchmaker_matched(makematch)

In my world_control module i tried to get the top_map from the sent data in the match_init and pass it to the game state like this:

function world_control.match_init(context, setupstate)
Local gamestate = {
map = setupstate. top_map

}
.
.
.

But when i use state.map later in the code it still nil i dont know whats i am doing wrong

Hello @M.Alatal,

The context of the makematch function will not contain query params because the registered function is not tied to an http request, the query_params is only present in the context for functions registered for RPC calls.

However you can access any properties that you set when submitting the ticket, you can access them like this.

Hope this helps.

1 Like

Thank you for the help