What is the easiest way to get the cloud script function result keys/values in the client so that I can use the values in the client code? Is it possible to use the cloud script function result as a dictionary?
Or is it necessary that I split the long string(result.Result.FunctionResult) somehow into pieces so that I can use the values in the client? I want to get this result in the client:
AddedNewValue = true; NewValue = 2500; ScoreRating = "Good";
For example, I have this cloud script and client code:
handlers.UpdateLeaderboard = function (args, context) { // ... var newvalue = 2500; var addednewvalue = true; var rating = "Good"; var resultdata = "Added value:" + addednewvalue.toString() + " " + "New value:" + newvalue.toString() + " " + "Rating:" + rating; return resultdata; }
bool AddedNewValue = false; int NewValue; string ScoreRating; private async Task UpdatePlayerHighscore(string leaderboardname, string playerscore, string level) { var result = await PlayFabClientAPI.ExecuteCloudScriptAsync(new ExecuteCloudScriptRequest() { FunctionName = "UpdateLeaderboard", FunctionParameter = new { Leaderboardname = leaderboardname, Playerscore = playerscore, Level = level }, GeneratePlayStreamEvent = true }); if (result.Error != null) Console.WriteLine(result.Error.Error.ToString()); else { if (result.Result.FunctionResult != null) { AddedNewValue = ...? NewValue = ...? ScoreRating = ...? } } }