How do I get array items

Get help using Construct 2

Post » Tue May 26, 2015 12:04 pm

Hi there,

I'm using a array to retrieve high score numbers and names from a server.

The string i retrieve is as this:
Code: Select all
{
"c2array":true,
"size":[10,2,1],
"data":[
["Jeroen",5000000],
["Harm",4587],
["Steven",1000],
["Pascal",999],
["Michael",998],
["Pim",722],
["Winnie",633],
["Elleke",598],
["Jeroen",579],
["Albert",527]
]
}


But when i use Array.at(0,0) or Array.at(1,0) i just get the first letter of each name.
ImageImage

What's happening???
B
3
Posts: 2
Reputation: 179

Post » Tue May 26, 2015 12:19 pm

try this string
Code: Select all
{"c2array":true,"size":[10,2,1],"data":[[["Jeroen"],[5000000]],[["Harm"],[4587]],[["Steven"],[1000]],[["Pascal"],[999]],[["Michael"],[998]],[["Pim"],[722]],[["Winnie"],[633]],[["Elleke"],[598]],[["Jeroen"],[579]],[["Albert"],[527]]]}
Image
B
63
S
23
G
7
Posts: 1,480
Reputation: 10,796

Post » Tue May 26, 2015 12:26 pm

Thanks
That worked
B
3
Posts: 2
Reputation: 179

Post » Tue May 26, 2015 8:29 pm

You have to include all three dimensions when working with C2-array JSON strings. You were missing the last dimension in your original string. It was included in @korbaach 's string.
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,414
Reputation: 4,822


Return to How do I....?

Who is online

Users browsing this forum: jaytrott86 and 7 guests