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: for

Previous Thread :: Next Thread 
ThePixel is not online. ThePixel
Joined: 15 May 2010
Total Posts: 225
29 Jul 2011 07:28 PM
I'm slowly learning Lua, mainly by editing scripts. Many times I see this, and don't know exactly what it does. Is it a for loop..?

for i =1,2 do

Thats just a example of one of them, what does it do, whats it used for and what are some cases it could be used in. Are there any lines similar to this I should know about?

If I had to guess, it only runs the script is i = 1 or 2? I don't see how that would be used much though.
Report Abuse
Cliff86 is not online. Cliff86
Joined: 01 Mar 2008
Total Posts: 216
29 Jul 2011 07:30 PM
repeats the code underneath from 1 to 2 increasing by 1 each time :P

the first time i = 1 the second time i = 2
Report Abuse
CODsniperkid is not online. CODsniperkid
Joined: 17 Jul 2009
Total Posts: 872
29 Jul 2011 07:32 PM
Basically. There are things with x = game.Workspace:GetChildren() "for i=1,#x do" as well, but you just keep learning:P

~COD~
Report Abuse
5943539 is not online. 5943539
Joined: 05 Jan 2010
Total Posts: 810
29 Jul 2011 07:33 PM
For loops run each time you specify, when i is greater than or equal to the second number.

for i=0,2 do

Runs the following 3 times until the end, with i being 0 the first time, 1 the second, and 3 the third.

for i=1,2 do

Runs it twice: i is 1 the first time and 2 the second.

for i=0,2,.5 do

Runs it five times. i is 0,.5,1,1.5,2 each time it runs.
Report Abuse
ThePixel is not online. ThePixel
Joined: 15 May 2010
Total Posts: 225
29 Jul 2011 08:02 PM
Thank you, how common are these, I don't see these being used in to many situations.
Report Abuse
boomhighman is not online. boomhighman
Joined: 12 Jul 2009
Total Posts: 145
29 Jul 2011 08:07 PM
==::Pretty Common::==



Boom
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