hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 07 Mar 2016 10:58 PM |
Do you know how to run a continuous for loop in roblox studio?
|
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 11:00 PM |
while true do for i, v in pairs (whatever) do end end
???
|
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 11:00 PM |
Why not:
repeat wait() until false
? |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 07 Mar 2016 11:03 PM |
Because it needs to be a for loop.
@AdvancedObjects That would be a while loop.
|
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 11:37 PM |
for i = 1, math.huge do
end |
|
|
| Report Abuse |
|
|
|
| 07 Mar 2016 11:41 PM |
for i = 1,10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e^10 do
end
|
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
| |
|
| |
|
|
| 08 Mar 2016 01:42 AM |
for i = 1,math.huge do end
I don't think 'i' will ever reach math.huge. Because math.huge is math.huge |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2016 01:43 AM |
| Technically speaking... it won't XDDDDDX |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 08 Mar 2016 08:38 AM |
@izzatnasruna Technically math.huge is the largest number that can be reached in roblox lua. Correct me if I'm wrong on that.
It is possible though. It is the equivlant of 'while true do end'.
|
|
|
| Report Abuse |
|
|
|
| 08 Mar 2016 10:00 AM |
Isn't a continous for loop the same thing as a loop that never stops? Just use a while [true] loop.
Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784 |
|
|
| Report Abuse |
|
|
ownedyou1
|
  |
| Joined: 03 Jul 2008 |
| Total Posts: 528 |
|
|
| 08 Mar 2016 10:43 AM |
deb=true while true do if deb==true then stoof() else wait() end wait() end |
|
|
| Report Abuse |
|
|
ownedyou1
|
  |
| Joined: 03 Jul 2008 |
| Total Posts: 528 |
|
|
| 08 Mar 2016 10:43 AM |
| the 2nd wait slows it down a lot reduces server impact |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 08 Mar 2016 11:37 AM |
@powerhotmail123 Because it is a trivia question.
|
|
|
| Report Abuse |
|
|
WoolHat
|
  |
| Joined: 19 May 2013 |
| Total Posts: 1873 |
|
|
| 08 Mar 2016 01:33 PM |
can't actually test this. Just want to play with the idea
local y = 2 for i = 1,y do y = y + 1 wait() end
If this doesn't work, I'd assume because the for loop doesn't check the variable y's value after each iteration. |
|
|
| Report Abuse |
|
|
| |
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 08 Mar 2016 04:29 PM |
This thread has had over 100 reviews and 16 replies. None of which is correct. So here is a hint, it is a generic for loop.
|
|
|
| Report Abuse |
|
|
| |
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
|
| 08 Mar 2016 05:00 PM |
| Why do you need an infinite for loop? What is it used for? |
|
|
| Report Abuse |
|
|
Garfanzo
|
  |
| Joined: 24 Apr 2015 |
| Total Posts: 742 |
|
|
| 08 Mar 2016 05:02 PM |
function bob() stuff wait(1) bob() end |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 08 Mar 2016 10:02 PM |
@Roblok1, it is like a trivia question. It isn't used for anything. The post doesn't say anything about using it.
@Garfanzo, that is tail-calling with a function
|
|
|
| Report Abuse |
|
|
Roblok1
|
  |
| Joined: 27 Jul 2011 |
| Total Posts: 2019 |
|
| |
|