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
 

Re: The wait() function

Previous Thread :: Next Thread 
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
01 Jul 2012 09:49 PM
I got this app on my iPod call iLuaBox, and I realized it doesn't have a wait() on it. I never knew this was limited to RBX.Lua only, and my question is would it be possible to create a wait function by making a for loop but do nothing inside of it? Or how else?
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
01 Jul 2012 09:51 PM
Try lagging up your iPod's memory with a table, then removing the values :P
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
01 Jul 2012 09:52 PM
os.sleep?
Report Abuse
rayoma is not online. rayoma
Joined: 13 Nov 2009
Total Posts: 1911
01 Jul 2012 09:53 PM
    function wait(num)
        local start_time=os.clock();
        while os.clock()>start_time+num do
        end
    end
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
01 Jul 2012 09:54 PM
oops thats not lua lol errm i'm, not sure if lua has a sleep function brb..

@SDuke; that'd just eat up memory tho
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
01 Jul 2012 09:56 PM
http://lua-users.org/wiki/SleepFunction
Report Abuse
rayoma is not online. rayoma
Joined: 13 Nov 2009
Total Posts: 1911
01 Jul 2012 09:56 PM
It works tho

Also roblox only crashes when you do something like that because it keeps waiting until the next frame is drawn.
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
01 Jul 2012 09:58 PM
yah i know i was just thinking he may want something more memory effecient
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
01 Jul 2012 09:59 PM
Smurfy, are Lua offsite links allowed?
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
01 Jul 2012 10:03 PM
not really lol. . .
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
01 Jul 2012 10:15 PM
So I would be able to do this on an iPod or would I need an external library?
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
02 Jul 2012 09:40 PM
The wait until os.time == originalOsTime+5 would work on any Lua reader/complier
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
03 Jul 2012 11:34 AM
I can't 'wait() until' if there is no wait function.
Report Abuse
BJCarpenter is not online. BJCarpenter
Joined: 04 Nov 2008
Total Posts: 4416
03 Jul 2012 11:42 AM
An endless For-loop would be the opposite of wait(); not a simulation of wait().

I believe that what u r looking for is delay(), but I am not usre.

Check here:

http://www.lua.org/manual/5.1/

GL,
Brian
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
03 Jul 2012 01:45 PM
function wait(milliseconds)
while (true) do
local deltaTime = tick()
while tick()-deltaTime < milliseconds do
end
end
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
03 Jul 2012 01:46 PM
Woops...

function wait(milliseconds)
local deltaTime = tick()
while tick()-deltaTime < milliseconds do
end
end
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
03 Jul 2012 06:56 PM
@BJ; iLuaBox doesn't have delay().

@MNN; Thanks, I'll see if that works.
Report Abuse
rayoma is not online. rayoma
Joined: 13 Nov 2009
Total Posts: 1911
03 Jul 2012 09:57 PM
@epic
remember to use `os.clock()` instead of `tick()` like I did in my example because tick is an rbx.lua specific function.
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
04 Jul 2012 02:28 PM
Okay, thanks.
Report Abuse
su8 is not online. su8
Joined: 06 Mar 2009
Total Posts: 6334
04 Jul 2012 02:30 PM
If iLuaBox is used to create stuff with render/game loops you shouldn't even use "waits".
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
04 Jul 2012 02:32 PM
It's not meant to create anything 3D if that's what you're saying.

Thread closed, I got it. Thanks.
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