How can I push object to array

Get help using Construct 2

Post » Mon Feb 03, 2014 12:21 pm

Hello.
Please, look on this:
screencast.com/t/Glmqw4Asw

How can I push to this variables object and use this object after?
[code]
[
{"get": 3, "gridSize": 3},
{"get": 3, "gridSize" 4}
]
[/code]
B
3
Posts: 3
Reputation: 181

Post » Mon Feb 03, 2014 1:46 pm

Wouldn't it be easier to put all values in a seperate "cell" of the array?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Feb 03, 2014 2:51 pm

Okey, now I got this
screencast.com/t/arCmX2IF5qIt

And output of console:
[code]
{"c2array":true,"size":[10,1,1],"data":[[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]],[[0]]]} [/code]

What I missed in example here? Size? Have I type this manually?

[code]"[{""gridSize"":3,""get"":3},{""gridSize"":3,""get"":3},{""gridSize"":3,""get"":3}]"[/code]
B
3
Posts: 3
Reputation: 181

Post » Mon Feb 03, 2014 3:38 pm

The simplest way to figure this out is to make a quick test project and manually assign the data into the array in the manner that you expect to see it. Dump the JSON string out, and then copy that format for your input data.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, MaxxMunnn, richcoz81 and 32 guests