citizenerased [Lexaloffle Blog Feed]https://www.lexaloffle.com/bbs/?uid=44857 Request: support for non-blocking stdin reads <p>Hello, I have a use case for some external tooling interacting with a running game. While the game is running I'd like it to process messages sent to it by the tooling. Currently it's not possible to do non-blocking reads from stdin. Calls to <code>serial(0x804, ...)</code> will block until the pico 8 process receives something. What I'd like to do is something like this:</p> <div> <div class=scrollable_with_touch style="width:100%; max-width:800px; overflow:auto; margin-bottom:12px"> <table style="width:100%" cellspacing=0 cellpadding=0> <tr><td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> <td background=/gfx/code_bg0.png> <div style="font-family : courier; color: #000000; display:absolute; padding-left:10px; padding-top:4px; padding-bottom:4px; "> <pre>function _update() -- Hypothetically stat returns true if there's data available on stdin, false otherwise, if stat(123) then serial(0x804, 0x4300, 1) local message_type = peek(0x4300, 1) process_message(message_type) end end</pre></div></td> <td background=/gfx/code_bg1.png width=16><div style="width:16px;display:block"></div></td> </tr></table></div></div> <p>It would be useful to have some way to tell if there's data available on stdin or to perform non-blocking reads from stdin.</p> https://www.lexaloffle.com/bbs/?tid=47983 https://www.lexaloffle.com/bbs/?tid=47983 Wed, 01 Jun 2022 07:37:16 UTC