LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
| |
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 26 Sep 2013 06:02 PM |
http://wiki.roblox.com/index.php/Ipairs#ipairs
I have a spider on my back. |
|
|
| Report Abuse |
|
|
databrain
|
  |
| Joined: 01 Jan 2013 |
| Total Posts: 3342 |
|
|
| 26 Sep 2013 06:36 PM |
Ipairs is for getting the number of what your indexing. like this: tab = {"A", "B", "C"} for i,v in ipairs(tab) do print(i, v) end
will print: 1 A 2 B 3 B
Pairs is for getting key values (Which is not the most useful thing in the world, but works well when trying to store 2 values to the same meaning in a table) like this: tab = {} tab['foo'] = "bar" tab['Hello,'] = "world!" for k,v in pairs(tab) do print(k, v) end
will print: foo bar Hello, world!
The l0z3r p00p3r of ATR |
|
|
| Report Abuse |
|
|
LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Sep 2013 06:53 PM |
| Don't ever use ipairs (numeric for's work the same, but MUCH faster, and pairs works the samish, but faster) |
|
|
| Report Abuse |
|
|
LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
| |
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Sep 2013 08:13 PM |
| Then you are adding invisible lag |
|
|
| Report Abuse |
|
|
LV1Z
|
  |
| Joined: 23 Jul 2011 |
| Total Posts: 652 |
|
|
| 26 Sep 2013 08:14 PM |
| which i do not get cuz i have a gaming pc, in which I built |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 26 Sep 2013 08:15 PM |
Doesn't matter, it still adds lag to the server if it's in a server-sided script. Not really noticeable, but still.
If you want to illiterate over, let's say workspace, the fastest way of doing it is: x = workspace:GetChildren() for i=1, #workspace do --code end
Which is more than twice as fast as ipairs |
|
|
| Report Abuse |
|
|