MINOR: hlua: add AppletTCP:try_receive()

This is the non-blocking variant for AppletTCP:receive(). It doesn't
take any argument, instead it tries to read as much data as available
at once. If no data is available, empty string is returned.

Lua documentation was updated.
This commit is contained in:
Aurelien DARRAGON
2025-03-31 13:55:35 +02:00
parent 86d3cfdeeb
commit 0ffc80d3ba
2 changed files with 38 additions and 0 deletions

View File

@@ -3912,6 +3912,15 @@ AppletTCP class
:returns: always return a string, the string can be empty if the connection is
closed.
.. js:function:: AppletTCP.try_receive(applet)
Reads available data from the TCP stream and returns immediately. Returns a
string containing read bytes that may possibly be empty if no bytes are
available at that time.
:param class_AppletTCP applet: An :ref:`applettcp_class`
:returns: always return a string, the string can be empty.
.. js:function:: AppletTCP.send(appletmsg)
Send the message on the stream.