mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-11 22:11:51 +00:00
update doc/*/scripting/builtins/libnetwork.md
This commit is contained in:
parent
7d6ddfa535
commit
a8d7475767
2 changed files with 16 additions and 16 deletions
|
|
@ -11,9 +11,9 @@ network.get(
|
||||||
-- Function to call when response is received
|
-- Function to call when response is received
|
||||||
callback: function(str),
|
callback: function(str),
|
||||||
-- Error handler
|
-- Error handler
|
||||||
[optional] onfailure: function(int),
|
[optional] onfailure: function(int, str),
|
||||||
-- List of additional request headers
|
-- List of additional request headers
|
||||||
[optional] headers: table<string>
|
[optional] headers: table<str>
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Example:
|
-- Example:
|
||||||
|
|
@ -24,9 +24,9 @@ end)
|
||||||
-- A variant for binary files, with a byte array instead of a string in the response.
|
-- A variant for binary files, with a byte array instead of a string in the response.
|
||||||
network.get_binary(
|
network.get_binary(
|
||||||
url: str,
|
url: str,
|
||||||
callback: function(table|ByteArray),
|
callback: function(ByteArray),
|
||||||
[optional] onfailure: function(int),
|
[optional] onfailure: function(int, str),
|
||||||
[optional] headers: table<string>
|
[optional] headers: table<str>
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Performs a POST request to the specified URL.
|
-- Performs a POST request to the specified URL.
|
||||||
|
|
@ -36,13 +36,13 @@ network.get_binary(
|
||||||
network.post(
|
network.post(
|
||||||
url: str,
|
url: str,
|
||||||
-- Request body as a table (will be converted to JSON) or string
|
-- Request body as a table (will be converted to JSON) or string
|
||||||
body: table|string,
|
body: table|str,
|
||||||
-- Function called when response is received
|
-- Function called when response is received
|
||||||
callback: function(str),
|
callback: function(str),
|
||||||
-- Error handler
|
-- Error handler
|
||||||
[optional] onfailure: function(int),
|
[optional] onfailure: function(int, str),
|
||||||
-- List of additional request headers
|
-- List of additional request headers
|
||||||
[optional] headers: table<string>
|
[optional] headers: table<str>
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,9 @@ network.get(
|
||||||
-- Функция, вызываемая при получении ответа
|
-- Функция, вызываемая при получении ответа
|
||||||
callback: function(str),
|
callback: function(str),
|
||||||
-- Обработчик ошибок
|
-- Обработчик ошибок
|
||||||
[опционально] onfailure: function(int),
|
[опционально] onfailure: function(int, str),
|
||||||
-- Список дополнительных заголовков запроса
|
-- Список дополнительных заголовков запроса
|
||||||
[опционально] headers: table<string>
|
[опционально] headers: table<str>
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Пример:
|
-- Пример:
|
||||||
|
|
@ -24,9 +24,9 @@ end)
|
||||||
-- Вариант для двоичных файлов, с массивом байт вместо строки в ответе.
|
-- Вариант для двоичных файлов, с массивом байт вместо строки в ответе.
|
||||||
network.get_binary(
|
network.get_binary(
|
||||||
url: str,
|
url: str,
|
||||||
callback: function(table|ByteArray),
|
callback: function(ByteArray),
|
||||||
[опционально] onfailure: function(int),
|
[опционально] onfailure: function(int, Bytearray),
|
||||||
[опционально] headers: table<string>
|
[опционально] headers: table<str>
|
||||||
)
|
)
|
||||||
|
|
||||||
-- Выполняет POST запрос к указанному URL.
|
-- Выполняет POST запрос к указанному URL.
|
||||||
|
|
@ -36,13 +36,13 @@ network.get_binary(
|
||||||
network.post(
|
network.post(
|
||||||
url: str,
|
url: str,
|
||||||
-- Тело запроса в виде таблицы, конвертируемой в JSON или строки
|
-- Тело запроса в виде таблицы, конвертируемой в JSON или строки
|
||||||
body: table|string,
|
body: table|str,
|
||||||
-- Функция, вызываемая при получении ответа
|
-- Функция, вызываемая при получении ответа
|
||||||
callback: function(str),
|
callback: function(str),
|
||||||
-- Обработчик ошибок
|
-- Обработчик ошибок
|
||||||
[опционально] onfailure: function(int),
|
[опционально] onfailure: function(int, str),
|
||||||
-- Список дополнительных заголовков запроса
|
-- Список дополнительных заголовков запроса
|
||||||
[опционально] headers: table<string>
|
[опционально] headers: table<str>
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue