Log In  
Follow
citizenerased
[ :: Read More :: ]

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 serial(0x804, ...) will block until the pico 8 process receives something. What I'd like to do is something like this:

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

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#112550 2022-06-01 07:37