array question

Get help using Construct 2

Post » Fri Jan 23, 2015 9:21 pm

How do I bulk add value into array. ie : tableX[3,5,7,8,9] ? Many thanks!
B
4
Posts: 13
Reputation: 224

Post » Sat Jan 24, 2015 2:19 am

You could use the function object to make a function which does it taking parameters.
Nothing goes unanswered!
B
24
S
5
G
1
Posts: 434
Reputation: 3,446

Post » Sat Jan 24, 2015 2:53 am

briggybros wrote:You could use the function object to make a function which does it taking parameters.


That's a good suggestion. You could also have a Text variable "1,3 5,7" or whatever and use tokenat() in a loop to extract the numbers directly in your code, or in fact pass it to a function as a single param. To pass a bunch of numbers (or params in general) to a Function individually is cumbersome IMO.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Jan 24, 2015 7:01 pm

Load from JSON string. It's ugly, but extensible.
"{""c2array"":true,""size"":[5,1,1],""data"":[[[3]],[[5]],[[7]],[[8]],[[9]]]}"
ImageImageImage
B
71
S
21
G
220
Posts: 3,646
Reputation: 123,721

Post » Sat Jan 24, 2015 9:58 pm

I'd go for something like this

number_array.png
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Madave96, RobertMKD and 7 guests