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 » Scripters
Home Search
 

Re: Wait() times

Previous Thread :: Next Thread 
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
09 Jul 2015 02:30 PM
wait() -- Approx. 1/30 of a second.
game:GetService'RunService'.RenderStepped:wait() -- Approx. 1/60 of a second.
coroutine.yield() -- ??

Please fill the blank.
Report Abuse
Tynezz is not online. Tynezz
Joined: 28 Apr 2014
Total Posts: 4945
09 Jul 2015 02:33 PM
print(coroutine.yield())
Report Abuse
MeneerManBLEE is not online. MeneerManBLEE
Joined: 14 Nov 2014
Total Posts: 86
09 Jul 2015 02:37 PM
1/35000
Report Abuse
GiganticGulian is not online. GiganticGulian
Joined: 18 Feb 2011
Total Posts: 2233
09 Jul 2015 02:37 PM
coroutine.yield yields until the coroutine is resumed again

here's an example

local thread = coroutine.wrap(function()
for i = 1, 4 do
print(i)
coroutine.yield()
end
end)

thread() -> 1
thread() -> 2
thread() -> 3
thread() -> 4
thread() -> 'cannot resume dead coroutine'

but coroutine.yield() also supports changing arguments, for example:

local thread = coroutine.wrap(function(argument)
for i = 1, 4 do
print(argument)
argument = coroutine.yield()
end
end)

thread("hi") -> "hi"
thread("bye") -> "bye"
thread("boo") -> "boo"
thread("poop") -> "poop"
thread("rip") -> 'cannot resume dead coroutine'
Report Abuse
gskw is not online. gskw
Joined: 05 Jan 2013
Total Posts: 1364
09 Jul 2015 02:38 PM
It varies a lot. I think it waits for the next task scheduler tick.

This is a signature. Recommended username: NosyGskw
Report Abuse
MeneerManBLEE is not online. MeneerManBLEE
Joined: 14 Nov 2014
Total Posts: 86
09 Jul 2015 02:41 PM
local wew = true;
local i = 0

spawn(function()
repeat
coroutine.yield()
i = i + 1
until
wew == false
end)

wait(1.1)
wew = false
print(i) --> 35000



local wew = true;
local i = 0

spawn(function()
repeat
wait()
i = i + 1
until
wew == false
end)

wait(1.1)
wew = false
print(i) --> 28



Report Abuse
NeonSkelion is not online. NeonSkelion
Joined: 16 Aug 2012
Total Posts: 12452
09 Jul 2015 02:41 PM
[ Content Deleted ]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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