|
| 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 |
|
|
|
| 01 Jul 2012 09:51 PM |
| Try lagging up your iPod's memory with a table, then removing the values :P |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
|
| 01 Jul 2012 09:56 PM |
| http://lua-users.org/wiki/SleepFunction |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 01 Jul 2012 09:59 PM |
| Smurfy, are Lua offsite links allowed? |
|
|
| Report Abuse |
|
|
smurf279
|
  |
| Joined: 15 Mar 2010 |
| Total Posts: 6871 |
|
| |
|
|
| 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 |
|
|
|
| 02 Jul 2012 09:40 PM |
| The wait until os.time == originalOsTime+5 would work on any Lua reader/complier |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2012 11:34 AM |
| I can't 'wait() until' if there is no wait function. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 03 Jul 2012 06:56 PM |
@BJ; iLuaBox doesn't have delay().
@MNN; Thanks, I'll see if that works. |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|