@vladislav You can already return JSON data as the match label, after all a JSON string is just a subset of all strings for validation purposes. In your Lua code you might return this from match_init
:
[...]
return state, tick_rate, nk.json_encode({ foo = "bar", baz = 123 })
[...]
The server will index and make the label searchable as you’d expect. Can you point me to where you found the 256 character limit mentioned? That’s likely an outdated documentation section or code example. The limit is 2048 characters (2 KB) which I think is useful for most cases.
As far as your original point - no, it’s not possible to read/return the match state or any portion of it outside the match handler. The label is the match’s way of communicating with the match listing system. In most cases you would put a subset of the match state in the label: player skill level, map being played, if the game is in progress or still waiting for more players before it starts etc. Whatever is appropriate for your use case.
The match state (or a significant part of it) is usually sent to clients when they join the match to “sync” them, then as the match progresses you would send small state deltas containing changes as they happen. This will make sure the clients have a constantly updating view of the server state.