|
| 22 Jul 2014 01:39 PM |
When you do for in pairs do,
if you did
for _, in pairs() do
what is the _ for, and what does it do? |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 01:44 PM |
its the value
for _, v in pairs v is the index so like table[v] and _ is the value so _:Destroy() get it?
glad i cud help |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 22 Jul 2014 01:46 PM |
Uhm,
for amount, index in pairs(parameters) do
The _ is just another way of saying 'i' because i's value is worth 1 and if you put _ then it converts to i.. Because that's the amount to go up each time;
a = {"Hello","Hi","Howdy"}
for i,v in pairs(a) do print(v) end
> Hello > Hi > Howdy
for j,v in pairs(a) do --j is equal to 2 print(v) end
>Hi
Same results with _ replacing i |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 01:46 PM |
for _, in pairs() do
The underscore ("_"), is the value. It could also be replaced as "i". |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 22 Jul 2014 01:48 PM |
| @Both, lolno.. _ or i is the number of index.. you can't destroy and int value.. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
| |
|
|
| 22 Jul 2014 01:50 PM |
| Well, no not a value. You're right. What i'm trying to say is that it could be replaced by "i"; just concerned that the underscore might confuse him. |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 01:53 PM |
"What i'm trying to say is that it could be replaced by "i""
uh no, it can be replaced with almost anything, not just 'i' .-.
|
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 01:53 PM |
Ah, I see. Why would on the wiki for leaderboards it say
for _, stat in pairs(stats) do Instance.new("IntValue", leaderstats).Name = stat end end)
Is stat also another thing for just "v"? |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 01:54 PM |
Um, yes...
I'm just using "i" as an example... |
|
|
| Report Abuse |
|
|
|
| 22 Jul 2014 01:55 PM |
@Dark, yes.
for i, v in pairs(stats) do Instance.new("IntValue", leaderstats).Name = v end end) |
|
|
| Report Abuse |
|
|
| |
|