Game Center Request Question (Turn-Based Multiplayer Example)

Simple question: 
 
 
 
Why must one use “matchDataEvent.data.data” instead of “matchDataEvent.data” ?
 
 

Source:
 
game-scene.lua

local function matchDataListener(matchDataEvent) if matchDataEvent.data.data and matchDataEvent.data.data ~= "" then local allData = json.decode(matchDataEvent.data.data) decodeData(allData) loadTable(allData.tableData) if matchDataEvent.data.currentParticipant.playerID == storyboard.myPlayerId then gl.overlay.isVisible = false else gl.overlay.isVisible = true turnText.text = "Wait for your turn" end else initTable() end for i = 1, #matchDataEvent.data.participants, 1 do if matchDataEvent.data.participants[i].playerID == storyboard.myPlayerId then myIndex = matchDataEvent.data.participants[i].index else theirIndex = matchDataEvent.data.participants[i].index end end end storyboard.gn.request("loadMatchData", { listener = matchDataListener, matchID = storyboard.matchId })

https://github.com/coronalabs/gameNetwork-iOS-turnbased-multiplayer

I figured it out. Sorry, the double data was a little confusing. 

So, since the event.type was “matchEnded” any of the following properties follow event.data:

event.data.matchID

event.data.data

etc.


A

“event.data in callback listener includes the following properties when event.type is matchEnded: match

Source: http://docs.coronalabs.com/daily/api/library/gameNetwork/request.html

B

 

"

A match object returned from gameNetwork.

Properties

"

Source: http://docs.coronalabs.com/daily/api/type/GameNetwork/match.html

I figured it out. Sorry, the double data was a little confusing. 

So, since the event.type was “matchEnded” any of the following properties follow event.data:

event.data.matchID

event.data.data

etc.


A

“event.data in callback listener includes the following properties when event.type is matchEnded: match

Source: http://docs.coronalabs.com/daily/api/library/gameNetwork/request.html

B

 

"

A match object returned from gameNetwork.

Properties

"

Source: http://docs.coronalabs.com/daily/api/type/GameNetwork/match.html