of     1   

ServerLabs
#44940089Friday, April 01, 2011 10:22 PM GMT

function Wait(seconds) A = os.clock() v = A + seconds while true do if os.clock() ~= v then end end end Wait(2) print 'lol' This is what I have so far (using SciTE), when I write 'Wait(2)' the loop doesn't end, and I wind up having to break the script. How can I fix it?
SilverRaptor
#44940161Friday, April 01, 2011 10:23 PM GMT

function Wait(seconds) A = os.clock() v = A + seconds while wait() do if os.clock() ~= v then end end end Wait(2) print 'lol' Also, where did you get os.clock() from?
crazypotato4
#44940206Friday, April 01, 2011 10:23 PM GMT

while os.clock ~= v do end Or while true do if os.clock() ~= v then break end end You never put anything that would let the loop stop/exit.
ServerLabs
#44940247Friday, April 01, 2011 10:24 PM GMT

http://www.lua.org/manual/5.1/manual.html#pdf-os.clock
crazypotato4
#44940251Friday, April 01, 2011 10:24 PM GMT

@Silver: wait() is a roblox-specific function. I believe that os is a standard Lua library ._.
ServerLabs
#44940468Friday, April 01, 2011 10:27 PM GMT

@patato it waits 3 seconds .. :c
SilverRaptor
#44940551Friday, April 01, 2011 10:29 PM GMT

Off topic, but I never realized how many math functions there are. I could return e with math.exp(1)! My life is complete!
ServerLabs
#44940579Friday, April 01, 2011 10:29 PM GMT

If you don't mind me asking, how is this off-topic?
Merlin11188
#44940863Friday, April 01, 2011 10:34 PM GMT

function Wait(t) s=time() repeat wait() until time()-s>=t end
Merlin11188
#44940903Friday, April 01, 2011 10:35 PM GMT

Yes, I know that defeats the purpose =P
nightname
#44941185Friday, April 01, 2011 10:40 PM GMT

Here is the custom wait command I use while I am not playing on Roblox: function wait(delay) delay = delay or 1 local time_to = tick() + delay while tick() < time_to do end end Hope this helps!
nightname
#44941454Friday, April 01, 2011 10:45 PM GMT

Wait... I forgot to edit it... Here is the right one. The other one was for my Roblox uses XD function wait(delay) delay = delay or 1 local time_to = os.time() + delay while os.time() < time_to do end end
ServerLabs
#44941511Friday, April 01, 2011 10:46 PM GMT

I'm using SciTE.. lua: cmath.lua:5: attempt to call field 'tick' (a nil value) stack traceback: cmath.lua:5: in function 'wait' cmath.lua:10: in main chunk [C]: ? >Exit code: 1 That's from your wait command, nightmare.
ServerLabs
#44941521Friday, April 01, 2011 10:46 PM GMT

Nevermind.
nightname
#44941604Friday, April 01, 2011 10:48 PM GMT

Sorry about that... I copied and pasted it from my Notepad++. I save all my functions somewhere XD

    of     1