More flexible variables in C3

Discussion and feedback on Construct 2

Post » Thu Feb 11, 2016 8:57 am

@Ashley

Variables in C2 are sub-optimal, for example it's not possible to pass a variable name as an argument and access it by name during runtime, this is very very inconvenient. I remember there were some security concerns and this is by design, but it is a bad design.

Will the situation with variables be different in C3?
B
45
S
11
G
4
Posts: 515
Reputation: 7,389

Post » Thu Feb 11, 2016 9:47 am

Maybe workaround by dictonary, which has string key and value pairs.
B
107
S
25
G
243
Posts: 4,387
Reputation: 137,466

Post » Thu Feb 11, 2016 10:23 am

@rexrainbow
yes, man - that's what I am doing now, when I need this flexibility. but these are still not variables and dictionary key-value pairs are not that easy to work with, compared to variables.

I think a separate behavior could solve it, basically creating variables and variables groups inside the behavior, being able to pass their names or even create new ones on runtime.
B
45
S
11
G
4
Posts: 515
Reputation: 7,389

Post » Thu Feb 11, 2016 11:44 am

I think what you are asking for is a pointer or reference to a variable? I find it hard to see how that fits in to the event system, and with event variables there are some tricky issues around the variable scope as well (e.g. should you be able to pass a pointer to a variable to somewhere outside of its scope? That is an error in some languages like C++). Either way the solution would probably be to reference variables by a string of their name, and that's exactly what the Dictionary object already does!
Scirra Founder
B
383
S
225
G
86
Posts: 24,134
Reputation: 190,601

Post » Thu Feb 11, 2016 11:51 am

I think I understand now :)
B
45
S
11
G
4
Posts: 515
Reputation: 7,389


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests