generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Get variable from string?

Previous Thread :: Next Thread 
Soapy29 is not online. Soapy29
Joined: 20 Aug 2009
Total Posts: 653
01 Sep 2013 03:27 PM
Hi. In my script, I made a string that is the same as a variable. When I try to call it, it prints the variable name, not the variable.

Example:

thing=1
decal1="asdf"

print("decal" .. thing)

That will print decal1, not asdf. Does anyone know how to make this work?
Report Abuse
expressmyself is not online. expressmyself
Joined: 19 Apr 2011
Total Posts: 1768
01 Sep 2013 03:32 PM
Because you put it as a string...

you do
print(decal1.." "..thing) -- I put the space to make it pretty
Report Abuse
Soapy29 is not online. Soapy29
Joined: 20 Aug 2009
Total Posts: 653
01 Sep 2013 03:34 PM
That isn't what I meant.. I am trying to create the variable name, and then display its contents. Basically combining a and b, so you have ab. Then look for the variable ab and print that.
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
01 Sep 2013 03:36 PM
newvar = (decal1..thing)
print(newvar)
Report Abuse
XtremeSpy is not online. XtremeSpy
Joined: 20 Nov 2011
Total Posts: 115
01 Sep 2013 03:41 PM
or

decal1 = "asdf"
thing = 1 -- Don't know why you didn't put quotations even though it works the same.
print(decal1..thing)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image