read-key timeout?
Posted: Wed Mar 07, 2007 6:24 pm
Is there a way of calling read-key so that if nothing is read for a certain time - eg a half-second - it completes?
Friends and Fans of newLISP
http://www.newlispfanclub.alh.net/forum/
http://www.newlispfanclub.alh.net/forum/viewtopic.php?f=2&t=1571
Code: Select all
#!/usr/bin/newlisp
(print "Enter something:")
(set 'cnt 0)
(while (and (= (peek 0) 0) (< cnt 50)) (sleep 100) (inc 'cnt))
(if (< cnt 50)
(println "User entered: " (read-line))
(println "nothing was entered"))
(exit)
Pity - I'm looking for a way to see if a key is being pressed, but if it isn't, continuing on.Lutz wrote:The following program would work for 'read-line' but not for 'read-key':
OK - trouble is, I keep seeing "newlisp talk in general" and posting there... :-)Lutz wrote: pps: please post only news and documentation stuff in the news section.