Hello,
I refer to this ticket: Make a match with 1 player only
I open this new case as it is a separate issue from the original ticket.
I need to read the properties of the match object in an RPC function.
The complete code is follows:
function rpcLSfindOrCreateMatch(context: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, payload: string): string
{
let json = JSON.parse(payload);
let limit = 10;
let isAuthoritative = true;
let label = json['aLabel'];
let minSize = 0;
let maxSize = 100;
//let matches: nkruntime.Match[] = [];
var matches = nk.matchList(limit, isAuthoritative, label, minSize, maxSize, "");
// If matches exist, sort by match size and return the largest.
let vIndex = -1;
if (matches.length > 0)
{
for (let vI = 0; vI < matches.length; vI++)
{
if (matches[vI].label == label)
{
vIndex = vI;
break;
}
}
}
if (vIndex > -1)
{
logger.warn('Found existing match');
return matches[vIndex].matchId;
}
else
{
var matchId = nk.matchCreate("lobby", { "label": label });
return JSON.stringify({ matchId });
}
}
When I try to compile this typescript code the compiler returns:
rpcLSfindOrCreateMatch.ts:21:29 - error TS2339: Property 'Label' does not exist on type 'Match'.
21 if (matches[vI].Label == label)
~~~~~
Is it possible that I’m wrong something like, for example, I don’t include definitions or anything else?
The property matchID is recognized but no LABEL.
What’s wrong?
thank you