Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it possible to make this a variable?

Asked by
7_c 37
7 years ago

click.Parent.Name == "Example"

What I mean is, Is it possible to make (Example) a variable? I just wanted to know if you could do it before I attempt another method.

2 answers

Log in to vote
0
Answered by 7 years ago

Yes, you can make a variable equal to a string.

local x = "Example"

click.Parent.Name = x

You can make almost anything a variable. Variables are very flexible.

Ad
Log in to vote
0
Answered by
movsb 242 Moderation Voter
7 years ago

If you want to make the strinf "Example" variable data, than you would easily do that like so:

local varName = "Example";

or

varName = "Example";

You could also use Example as a variable name, if that is what you are asking, however to use the string "Example" as a variable name, you would have to use a key, and store it in a module, or a table of data instead, I will use the global module _G in this example:

_G["Example"] = "Example";

And I could call the value by saying:

_G["Example"]

really its just a custom index.

Answer this question