This question has been haunting me for a while now; is there a way in lua to check if there is any data available on stdio and only then read it?
For example; let's say I have some sort of server that is doing its important stuff that shouldn't be interrupted by a blocking io.read() function, but I still want to be able to input commands on the console.
I have tried io.read(0) but even that blocks until it gets an EOF
I would suggest to write a custom pure C-library to check it.
https://stackoverflow.com/a/26949111/1979882
here an example to how create a C-library for Lua. http://cs.brynmawr.edu/Courses/cs380/fall2011/luar-topics2.pdf
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With