Note that there are some explanatory texts on larger screens.

plurals
  1. POEasiest way to make lua script wait/pause/sleep/block for a few seconds?
    primarykey
    data
    text
    <p>I cant figure out how to get lua to do any common timing tricks, such as</p> <ul> <li><p>sleep - stop all action on thread </p></li> <li><p>pause/wait - don't go on to the next command, but allow other code in the application to continue </p></li> <li><p>block - don't go on to next command until the current one returns</p></li> </ul> <p>And I've read that a </p> <pre><code>while os.clock()&lt;time_point do --nothing end </code></pre> <p>eats up CPU time.</p> <p>Any suggestions? Is there an API call I'm missing?</p> <p><strong>UPDATE</strong>: I wrote this question a long time ago trying to get WOW Lua to replay actions on a schedule (i.e. stand, wait 1 sec, dance, wait 2 sec, sit. Without pauses, these happen almost all in the same quarter second.) <a href="https://stackoverflow.com/questions/1024960/how-do-you-make-a-combo-of-two-emotes-in-lua-in-world-of-warcraft-work?lq=1">As it turned out WOW had purposely disabled pretty much everything that allows doing action on a clock because it could break the game or enable bots.</a> I figured to re-create a clock once it had been taken away, I'd have to do something crazy like create a work array (with an action and execution time) and then register an event handler on a bunch of common events, like mouse move, then in the even handler, process any action whose time had come. The event handler wouldn't actually happen every X milliseconds, but if it was happening every 2-100 ms, it would be close enough. Sadly I never tried it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload