Posted by member 5575 on 2006-04-27 21:35:37 link

Does os.clock() give you a decimal time in seconds? If so, then that's an easier way to get the time than using os.time()+lslua.milli()/1000. as I did. os.time() only gave integer seconds, IIRC.

The loop you've made there seems to assume that each passage through the loop takes one millsecond though; I don't think you can assume that, generally speaking. I think you'll find that it takes much less time than that, and so you'll end up with shorter pauses than you anticipated. If os.clock()is a decimal time in seconds, then you could do something like the followinbg instead:

function pauseit (arg)
local finish = os.clock () + tonumber (arg)/1000
while os.clock() < finish do
-- nothing
end
end