|
| 08 Sep 2014 06:36 PM |
| How do I use next in a generic for loop? I just need an example. Please help! |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2014 06:46 PM |
| Buuump. I'm not asking for someone to make a script, just give an example, just like a table with 2 messages in it, and print them in order. |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 08 Sep 2014 06:56 PM |
table = {"Apple","Pie","Pickles"}
for i,v in next, table do print(v) end
>Apple >Pie >Pickles |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2014 07:00 PM |
| Say you touch a brick and have the loop execute. Is there a way just to have it print one at a time, like on the first touch it prints "Apple", then the next one "Pie"? |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 08 Sep 2014 07:03 PM |
part = workspace.Part
n = 0 db = false
part.Touched:connect(function(h) if not db then db = true n = n + 1 if n == 1 then print("Apple") elseif n == 2 then print("Pie") elseif n == 3 then print("Pickles") end end wait(1) db = false end) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2014 07:06 PM |
| I guess the non-table version will have to do. Thanks though, man. Now I know about next. |
|
|
| Report Abuse |
|
|