lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 06-Mar-17 07:43, Sean Conner wrote:
It was thus said that the Great Dirk Laurie once stated:
2017-03-06 8:35 GMT+02:00 Daurnimator <quae@daurnimator.com>:
On 6 March 2017 at 17:31, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2017-03-06 7:53 GMT+02:00 Sean Conner <sean@conman.org>:
It was thus said that the Great Dirk Laurie once stated:
I've searched the manual for "sleep", "wait", "pause", "delay"
and not found any except the pauses of the GC. Does it have
a different name or must I load some module?

  In the context of POSIX:

        sleep() pause execution for a given amount of time
        wait()  pause execution until a child process exits
        pause() pause execution until a signal happens
        delay   there is no spoon

  -spc (So what exactly are you trying to achieve?)

A semi-animated slideshow in lcurses. I have a Turbo Pascal
mindset when it comes to fullscreen text apps. Unit Crt used to
have a "Delay", lcurses seems not to.

Do you actually want to sleep for X seconds?
Or do you want to sleep for X seconds *or* until input is received?
(e.g. to allow pressing 'space' to go forwards a slide manually)

I can imagine that one would crave for the latter sooner or later,
although for now the former will do.

  Then you want to look up select(), poll(), epoll() or kqueue(), depending
upon your operating system.

  -spc (Don't know the Windows equivalent ... )

readline has rl_callback_handler_install() and rl_callback_read_char() to handle input from other sources while waiting for keyboard input. I am not sure how easy it would be to handle them from Lua.

As for Windows, you can just get keyboard events in the window message queue and handle them as you wish. At least, that is what I remember from last time I used it in C.

--
  Enrico