|
| 09 Jun 2015 03:48 PM |
I need to create separate variables for each GUI made, when the GUI making process is a for loop like so:
for i=1, 10 do --bla bla bla end
It wouldn't let me do something like: i .. "derp" = "ayayayay"
Any help would be appreciated, thanks in advance. |
|
|
| Report Abuse |
|
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 09 Jun 2015 03:51 PM |
What?
Thing[i..'derp'].Banana = i |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2015 03:56 PM |
So "Thing" would be the variable? Can you re-structure that so I can use it for my own purposes, please?
Here's what I want it to do:
derp .. i = 16 |
|
|
| Report Abuse |
|
|
jode6543
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 5363 |
|
|
| 09 Jun 2015 03:58 PM |
Wait, what is it you want? "derp .. i = 16" You can't do that. That's invalid syntax; Lua has no idea what that means and neither do I. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2015 04:02 PM |
| Add the amount of times i has looped to "derp" to form a new variable such as 2derp and set it to "ayayayay". |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 09 Jun 2015 04:03 PM |
derpies = {}; for i=1,10 do derpies[i..'derp'] = 16; end
print(derpies['3derp']) --> 16 |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2015 04:14 PM |
| I'm confused though, what is "derpies"? |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 09 Jun 2015 04:15 PM |
| A table. Learn to use them. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2015 04:21 PM |
for i=1, 10 do getfenv(0)["derp"..i] = "yayme" end
print(derp1, derp2, derp3, derp4, derp5, derp6, derp7, derp8, derp9, derp10) |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 09 Jun 2015 04:22 PM |
| I didn't give that solution because it's not practical and he needs to learn tables anyway. |
|
|
| Report Abuse |
|
|
|
| 09 Jun 2015 04:30 PM |
I did however give that solution because it is what he asked for. You gave him reality, I gave him his dream.
XD |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 09 Jun 2015 04:31 PM |
OP WANTS TO CONCATENATE ROBLOX FUNCTIONS! looks at thread WTF UR TITLE IS MISLEADING looks at replies WTF IS THAT WHAT HE WANTED looks at pos reply WTF IM GONNA ACT LIKE A MORON NOW |
|
|
| Report Abuse |
|
|
| |
|