localnk=require("nakama")locallimit=10localisAuthoritative=truelocallabel="skill=100-150"localmin_size=0localmax_size=4localmatches=nk.match_list(limit,isAuthoritative,label,min_size,max_size)for_,matchinipairs(matches)donk.logger_info(string.format("Match id %s",match.match_id))end
Server
1
2
3
4
5
6
7
8
9
10
11
12
13
limit:=10isAuthoritative:=truelabel:="skill=100-150"min_size:=0max_size:=4ifmatches,err:=nk.MatchList(ctx,limit,isAuthoritative,label,min_size,max_size,"");err!=nil{logger.WithField("err",err).Error("Match list error.")}else{for_,match:=rangematches{logger.Info("Match id %s",match.GetMatchId())}}
Server
1
2
3
4
5
6
7
8
9
10
11
12
functiongetMatchListings(context: nkruntime.Context,logger: nkruntime.Logger,nk: nkruntime.Nakama){constlimit=10constisAuthoritative=true;constlabel="skill=100-150";constminSize=0;constmaxSize=4;constmatches=nk.matchList(limit,isAuthoritative,label,minSize,maxSize,"");matches.forEach(function(match){logger.info("Match id '%s'",match.matchId);});}
localnk=require("nakama")locallimit=10localisauthoritative=truelocallabel=""localmin_size=0localmax_size=4localquery="+label.skill>=100 +label.skill<=150"localmatches=nk.match_list(limit,isauthoritative,label,min_size,max_size,query)for_,matchinipairs(matches)donk.logger_info(string.format("Match id %s",match.match_id))end
Server
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
limit:=10authoritative:=truelabel:=""minSize:=0maxSize:=4query:="+label.skill>=100 +label.skill<=150"matches,err:=nk.MatchList(ctx,limit,authoritative,label,minSize,maxSize,query)iferr!=nil{logger.WithField("err",err).Error("Match listings error.")return}for_,match:=rangematches{logger.Info("Match id %s",match.MatchId)}
Server
1
2
3
4
5
6
7
8
9
10
11
12
functionfindMatch(context: nkruntime.Context,logger: nkruntime.Logger,nk: nkruntime.Nakama){constlimit=10constisAuthoritative=true;constminSize=0;constmaxSize=4;constquery="+label.skill>=100 +label.skill<=150";varmatches=nk.matchList(limit,isAuthoritative,minSize,maxSize,query);matches.forEach(function(match){logger.info("Match id '%s'",match.matchId);});}
functionfindOrCreateMatch(context: nkruntime.Context,logger: nkruntime.Logger,nk: nkruntime.Nakama):string{varmatches=nk.matchList(limit,isAuthoritative,label,minSize,maxSize,"");// If matches exist, sort by match size and return the largest.
if(matches.length>0){matches.sort(function(a,b){returna.size>=b.size?1:-1;});returnmatches[0].matchId;}// If no matches exist, create a new one using the "lobby" module and return it's ID.
varmatchId=nk.matchCreate('supermatch',{});returnJSON.stringify({matchId});}
query:="+label.skill>=100 +label.skill<=150"matches,err:=nk.MatchList(ctx,1,true,"",2,4,query)iferr!=nil{logger.WithField("err",err).Error("List match error.")return}iflen(matches)>0{logger.Info(matches[0].MatchId)}else{matchId,err:=nk.MatchCreate(ctx,"matchname",nil)iferr!=nil{logger.WithField("err",err).Error("Match create error.")return}logger.Info(matchId)}
Server
1
2
3
4
5
6
7
8
9
10
11
12
13
functionfindOrCreateMatch(context: nkruntime.Context,logger: nkruntime.Logger,nk: nkruntime.Nakama){constquery="+label.skill>=100 +label.skill<=150";varmatches=nk.matchList(10,true,"",2,maxSize,query);// If matches exist, sort by match size and return the largest.
if(matches.length>0){logger.info("Match id '%s'",matches[0].matchId);}// If no matches exist, create a new one using the "lobby" module and return it's ID.
varmatchId=nk.matchCreate('supermatch',{});logger.info(matchId);}
localnk=require("nakama")locallimit=10localisAuthoritative=truelocalmin_size=5localmax_size=7localmatches=nk.match_list(limit,isAuthoritative,min_size,max_size)for_,matchinipairs(matches)donk.logger_info(string.format("Match id %s",match.match_id))end
Server
1
2
3
4
5
6
7
8
9
10
11
12
limit:=10isAuthoritative:=truemin_size:=5max_size:=7ifmatches,err:=nk.MatchList(ctx,limit,isAuthoritative,min_size,max_size,"");err!=nil{logger.WithField("err",err).Error("Match list error.")}else{for_,match:=rangematches{logger.Info("Match id %s",match.GetMatchId())}}
Server
1
2
3
4
5
6
7
8
9
10
11
functiongetMatchListings(context: nkruntime.Context,logger: nkruntime.Logger,nk: nkruntime.Nakama){constlimit=10constisAuthoritative=true;constminSize=5;constmaxSize=7;constmatches=nk.matchList(limit,isAuthoritative,minSize,maxSize,"");matches.forEach(function(match){logger.info("Match id '%s'",match.matchId);});}