Author Topic: Turning a string into a variable?  (Read 884 times)

How could I turn a string into a variable? I'm stuck here...

%var = "stuff"; ?

What are you actually trying to do here?

If you mean doing something like

"stuff" = somethingelse;

That's impossible in any scripting language as far as I know.

If you mean doing something like

"stuff" = somethingelse;

That's impossible in any scripting language as far as I know.

You can do this if you really need to, but I can't think of anything where it makes any sense to do it. So I'm asking what he's actually making.

%var = "stuff"; ?

What are you actually trying to do here?

I mean.. Creating a variable out of a string. Like.. If I had generated 10 brick studs up with I++;, then how would I make a variable for each I that exists? The only way I can think of doing this is making a code that makes a word named "Brick", "Brick1", "Brick2", etc. for each count..

Just put all the bricks in an array:

%brick[%i] = stuff

Well it's not really an array, but close enough.

I believe you mean an array.
%foo[%index] = "bar";
Just put all the bricks in an array:

%brick[%i] = stuff

Well it's not really an array, but close enough.
beat me to it

Edited:
%brick[0] literally is the same thing as %brick0, and multiple dimension arrays work like so.
%brick[0, 0] = "data";
And is equal to %brick0_0.
« Last Edit: February 24, 2016, 07:54:02 AM by Pah1023 »

Just put all the bricks in an array:

%brick[%i] = stuff

Well it's not really an array, but close enough.

..I can't believe I didn't think of that... Thanks again ;-; wow lmao