Sign In Register

How can we help you today?

Start a new topic

What's the best way to pass an array from GameSparks to the Application?

I'm working on an application that revolves around the users receiving a list of questions to answer that I can update from the server side.  

The question objects in my script are custom objects with three fields. All three fields are strings, the first field is the question, the second and third fields are the two answer options.  

Currently I'm using a somewhat awkwardly hacked together method of passing the questions to the application from the gamesparks properties tab.

I need to be able to send a list of multiple of these question objects at once, right now I'm just sending three strings to the application, a string of questions, a string of optionOne's, and a string of optionTwo's, and it's just one long string for each of these containing all of these.

the "questsions" string contains all of the questions in order, seperated by semicolons.

the "optionOne" and "optionTwo" strings contain all of the option one and option two answer choices in order seperated by semicolons.

Then inside the application these strings are being parsed with for loops to create my custom question objects out of them, it takes the first chunk of each of them up to their first semicolon and creates an object with those 3 strings, and so on and so on.

I really don't think this is a good method of doing this. It seems like a lot of extra computation being done that shouldn't be necessary, and any small typo somewhere has the potential to blow everything up.

I'm sure there's some way to pass these in in a much better format, but trying to pass them in as any sort of array hasn't worked for me. Can anyone help with this?

Hi Keegan,

What SDK are you using?

When trying to send your data as an array, did you get errors? If so, what were they?

It should be entirely possible to send the data as an array formatted like this:












and then retrieve it client side using GSData's getGSDataList() function. Is this the way you were trying to implement it? What issues specifically were you encountering?



My "Property" in GameSparks currently looks like this:


    "propositions": [


            "Who will win?",





            "Who will win?",






, however when I do a getPropertyRequest on the property name and then use response.Property.GetGSDataList("propositions"); my GSDataList().Count is always 0.

Login to post a comment