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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 01 Sep 2013 03:36 PM |
newvar = (decal1..thing) print(newvar) |
|
|
| Report Abuse |
|
|
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 |
|
|