Javascript array to C2 array

For developers using the Construct 2 Javascript SDK

Post » Sun Aug 03, 2014 4:29 pm

I have made an algorithm in javascript and used it in my own plugin to return the results. That works fine.

Now I would like to return an Array from my javascript plugin and load it into a C2 array. I've tried to use JSON.stringify(myOneDimensionalArray) and return this string in the plugin, and then in C2 tried to load the string from JSON, but i guess C2 expects a 3D array and my array is one dimensional.

Maybe I could make some string manipulation in my Javascript and make it look like a C2 array but is this the right way to go - or do some of you have a better approach?
B
4
S
1
Posts: 8
Reputation: 366

Post » Sun Aug 03, 2014 4:36 pm

@oswald73

You might try to export data into Yann's JSON plugin
B
108
S
26
G
259
Posts: 4,432
Reputation: 145,687

Post » Sun Aug 03, 2014 8:07 pm

Thank you. It works perfectly.
B
4
S
1
Posts: 8
Reputation: 366


Return to Javascript SDK

Who is online

Users browsing this forum: norman74 and 1 guest