update doc/*/scripting/builtins/libnetwork.md

This commit is contained in:
MihailRis 2025-09-16 23:22:31 +03:00
parent 7d6ddfa535
commit a8d7475767
2 changed files with 16 additions and 16 deletions

View File

@ -11,9 +11,9 @@ network.get(
-- Function to call when response is received
callback: function(str),
-- Error handler
[optional] onfailure: function(int),
[optional] onfailure: function(int, str),
-- List of additional request headers
[optional] headers: table<string>
[optional] headers: table<str>
)
-- Example:
@ -24,9 +24,9 @@ end)
-- A variant for binary files, with a byte array instead of a string in the response.
network.get_binary(
url: str,
callback: function(table|ByteArray),
[optional] onfailure: function(int),
[optional] headers: table<string>
callback: function(ByteArray),
[optional] onfailure: function(int, str),
[optional] headers: table<str>
)
-- Performs a POST request to the specified URL.
@ -36,13 +36,13 @@ network.get_binary(
network.post(
url: str,
-- Request body as a table (will be converted to JSON) or string
body: table|string,
body: table|str,
-- Function called when response is received
callback: function(str),
-- Error handler
[optional] onfailure: function(int),
[optional] onfailure: function(int, str),
-- List of additional request headers
[optional] headers: table<string>
[optional] headers: table<str>
)
```

View File

@ -11,9 +11,9 @@ network.get(
-- Функция, вызываемая при получении ответа
callback: function(str),
-- Обработчик ошибок
[опционально] onfailure: function(int),
[опционально] onfailure: function(int, str),
-- Список дополнительных заголовков запроса
[опционально] headers: table<string>
[опционально] headers: table<str>
)
-- Пример:
@ -24,9 +24,9 @@ end)
-- Вариант для двоичных файлов, с массивом байт вместо строки в ответе.
network.get_binary(
url: str,
callback: function(table|ByteArray),
[опционально] onfailure: function(int),
[опционально] headers: table<string>
callback: function(ByteArray),
[опционально] onfailure: function(int, Bytearray),
[опционально] headers: table<str>
)
-- Выполняет POST запрос к указанному URL.
@ -36,13 +36,13 @@ network.get_binary(
network.post(
url: str,
-- Тело запроса в виде таблицы, конвертируемой в JSON или строки
body: table|string,
body: table|str,
-- Функция, вызываемая при получении ответа
callback: function(str),
-- Обработчик ошибок
[опционально] onfailure: function(int),
[опционально] onfailure: function(int, str),
-- Список дополнительных заголовков запроса
[опционально] headers: table<string>
[опционально] headers: table<str>
)
```