In many ways this question follows on from my previous one. On reflection I felt that what I really wanted to do was to show league table with the scores + handles of the “best” players and then the current player followed by the scores + handles of the players immediately below the current player.
To that end I am getting my server-side code to return a table with up to nine entries - between 0 and 4 from the “best players”, the current player and then between 0 and 4 below the current player.
In order to do this I decided to clone the nodes required to show each league table entry on-the-fly. The node in question has the following structure
- A containing box
- Two inner boxes each containing a text node which I desiginate as my score and *handle * text nodes.
For arguments sake le t us call the outer box boxLeagueTableRow and the two text nodes txtScore & txtHandle
This approach allows for much flexibility and I can show the position of the current player in the league table in all possible circumstances - better players exist, no better players exist, worse players exist… .
The problem I have is this: gui.clone_tree returns a table containing the hashes for the items it has cloned. Very good. But having cloned the node I now need to update the text content of the two text nodes I have just cloned. I have the league table data sent down by my servers to do so. However, the order of the hashes returned in clones table is not guaranteed. So how do I go about establishing which of the hashes match the two freshly created text nodes?