Merge pull request #964 from Xertis/main

Implementation of socket:peek
This commit is contained in:
MihailRis 2026-09-04 00:09:56 +03:00 • committed by GitHub
commit 968528c706
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 73 additions and 7 deletions

View file

@ -92,6 +92,21 @@ socket:recv_async(
[optional] usetable: bool=false
) -> nil|table|Bytearray
-- `peek` and `peek_async` are analogous to the `recv` and `recv_async` methods
-- with the exception that `peek` and `peek_async` do not advance the socket buffer position
-- This means they do not remove bytes from the socket, so the bytes can be received after
socket:peek(
length: int,
[optional] usetable: boolean=false
) -> nil|table|Bytearray
socket:peek_async(
length: int,
[optional] usetable: boolean=false
) -> nil|table|Bytearray
Translated with DeepL.com (free version)
-- Closes the connection
socket:close()