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: Quick Question

Previous Thread :: Next Thread 
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
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
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
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 is not online. 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
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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 is not online. 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 is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
22 Jul 2014 01:48 PM
for _,v in pairs() do*
Report Abuse
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
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
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
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
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
22 Jul 2014 01:54 PM
Um, yes...

I'm just using "i" as an example...
Report Abuse
ninja900500 is online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
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
DarkheartSkillz is not online. DarkheartSkillz
Joined: 30 Sep 2011
Total Posts: 5125
22 Jul 2014 01:56 PM
Makes sense. Thanks!
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