How do I store an array in a dictionary

Get help using Construct 2

Post » Fri Jul 10, 2015 1:38 am

I could do it using a delimiter and tokenat, but has anyone made a plugin to make this more intuitive?

In JavaScript, I could do something like this: {fruit: ["apple", "orange", "pair"], vegetables: ["carrot", "onion", "potato"]}
I could also fake it using a 3d array, but it's not as clean and would require a little more code.

If I wrote my own plugin to solve this problem... Would anyone find it useful :)
B
12
S
2
Posts: 39
Reputation: 1,082

Post » Fri Jul 10, 2015 8:49 am

I might be dumber than I thought, but why would you want to store an array in a dictionary object?
Isn't there a reason why they are two different kinds of objects, each with their own benefits?

There is however a csv to array and csv to dictionary plugin, if that's what you are after..
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 » Fri Jul 10, 2015 9:21 am

LittleStain wrote:I might be dumber than I thought.


hehe
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Fri Jul 10, 2015 2:05 pm

You might be interested in this plugin : plugin-table-2d-dictionary_t125862
B
71
S
30
G
25
Posts: 984
Reputation: 19,503

Post » Sat Jul 11, 2015 6:30 am

Storing key value pairs in an array (and vice versa) is a pretty standard thing to do in programming. The two offer a lot of power.

For example, the 3rd x element in an array might hold some parameters, and one of those parameters might be an array itself. This can be achieved with TokenAt, but it's not as intuitive and is a bit of a code smell (In my opinion). I could utilize the z axis but would still end up needing TokenAt to store an array inside an array.

Having said all that, Construct 2 is a phenomenal tool with an SDK that allows you to do pretty much anything... So I'm not complaining, just looking to see what's out there!

Thanks Magistross, will check it out!
B
12
S
2
Posts: 39
Reputation: 1,082


Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag and 26 guests