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
 

[i]

Previous Thread :: Next Thread 
cupcakescankill is not online. cupcakescankill
Joined: 24 Oct 2008
Total Posts: 13261
28 Mar 2009 11:16 AM
What does [i] in a script mean? What is is used for?
Report Abuse
cymru72 is not online. cymru72
Joined: 26 Jan 2008
Total Posts: 4362
28 Mar 2009 11:17 AM
I think your talking about a Index in a table.

local Table = {"Hai", "Lol", ":P"}

print(
Table[1],
Table[2],
Table[3]
)
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
28 Mar 2009 11:19 AM
p = game.Players:GetChildren()
for i = 1, #p do
p[i].Character.Head:Remove()
end

I am not sure, but I know that i is a variable.

p is the children of players.

i is a variable.

I think it does that loop the number of children there are.

Sorry if that doesn't help.
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
28 Mar 2009 11:21 AM
It's usually used within a for loop to get each individual item of a table.


a=game.Players:GetChildren()

--now assume a = {game.Players.blobbyblob, game.Players.cymru72, game.Players.cupcakescankill}

for i = 1 to #a do
--this will start up a loop that goes from 1 to #a. #a is the number of components in table "a" which is 3

print(a[i].Name)
--this will loop through the table printing everyone's name

end
--this ends the for loop.



Get it?
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
28 Mar 2009 11:23 AM
So I was partly right?
Report Abuse
cymru72 is not online. cymru72
Joined: 26 Jan 2008
Total Posts: 4362
28 Mar 2009 11:24 AM
local Table = {"Hai", "Lol", ":P"}

print(
Table[1],
Table[2],
Table[3]
)

print(
table.concat(Table, " ")
)
Report Abuse
blobbyblob is not online. blobbyblob
Joined: 29 Oct 2008
Total Posts: 12165
28 Mar 2009 11:26 AM
Yeah, DrAgon. I didn't know you were posting, though, because I spent a while writing that.
Report Abuse
EndBuilder is not online. EndBuilder
Joined: 25 Mar 2009
Total Posts: 30
28 Mar 2009 11:27 AM
Its the way the language gives the address of the data ina especific space, and its calculated in the next form:

new_address = address_expression + (interger(In this case i) * size_of_base_type)

addresses in a table are next to each other so, in the case the values in the table are interger (numbers with no decimal) in a 32 bit system (Almost all of the actual) would be lets say the first element of the table has an addres og 0x1000 then the next element would be?
lets use the formula new_address = address_expression + (interger(In this case i) * size_of_base_type)

new_address = 1000 + (i which would be 1 * 4)
new_adress = 1004 and the computer will access to the next value in the table...
Report Abuse
cymru72 is not online. cymru72
Joined: 26 Jan 2008
Total Posts: 4362
28 Mar 2009 11:28 AM
Heres a small example:

local Table = {"Hai", "LOOL", "XD", ":P"}

for Index, Data in pairs(Table) do
print(Data, Index)
end

Data will return the string value inside the table, Index will return a numerical value.
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