Turning strings into expressions

Discuss game development design and post your game ideas

Post » Thu Aug 24, 2017 1:44 pm

To my dismay I had to find out today that there is no way to convert a string into an expression.

If I want to check if "Sprite.c"&loopindex, while having c0, c1, c2, ..., on that Sprite, I can only do that if c0/c1/c2/.. are numbers, not strings, via int(str("Sprite.c"&loopindex)). I can't do that if c0/c1/c2 are strings.

That's why I request the addition of an 'expr()' command, to turn strings into expressions.
B
6
S
1
Posts: 12
Reputation: 424

Post » Thu Aug 24, 2017 2:57 pm

Not only would such a feature be incredibly complex to implement, I don't think it's actually necessary. It looks like you want to use an index in to instance variables. Instead, you can put an Array in a container with the sprite and just index in to the array.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,625


Return to Game Development, Design & Ideas

Who is online

Users browsing this forum: SuperJetSerum99 and 7 guests