@defold-typescript/types 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/api-availability.json +333 -306
  2. package/api-signatures.json +1312 -0
  3. package/api-targets.json +351 -2
  4. package/examples/translations.json +1984 -0
  5. package/fixtures/messages_doc.json +880 -0
  6. package/generated/collectionproxy.d.ts +22 -0
  7. package/generated/editor-vm/http.d.ts +2 -2
  8. package/generated/editor-vm/image.d.ts +48 -0
  9. package/generated/editor.d.ts +27 -8
  10. package/generated/gui.d.ts +35 -6
  11. package/generated/kinds/editor-script.d.ts +1 -0
  12. package/generated/material.d.ts +4 -0
  13. package/generated/versions/defold-1.12.4/liveupdate.d.ts +22 -22
  14. package/generated/versions/defold-1.12.4/physics.d.ts +78 -75
  15. package/generated/versions/defold-1.12.4/render.d.ts +75 -55
  16. package/generated/versions/defold-1.12.4/resource.d.ts +187 -175
  17. package/generated/versions/defold-1.13.0/b2d.d.ts +33 -0
  18. package/generated/versions/defold-1.13.0/b2d_body.d.ts +676 -0
  19. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +106 -0
  20. package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +155 -0
  21. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +823 -0
  22. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +215 -0
  23. package/generated/versions/defold-1.13.0/b2d_world.d.ts +314 -0
  24. package/generated/versions/defold-1.13.0/buffer.d.ts +176 -0
  25. package/generated/versions/defold-1.13.0/camera.d.ts +302 -0
  26. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +146 -0
  27. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +71 -0
  28. package/generated/versions/defold-1.13.0/compute.d.ts +306 -0
  29. package/generated/versions/defold-1.13.0/crash.d.ts +143 -0
  30. package/generated/versions/defold-1.13.0/editor-vm/http.d.ts +56 -0
  31. package/generated/versions/defold-1.13.0/editor-vm/json.d.ts +10 -0
  32. package/generated/versions/defold-1.13.0/editor-vm/localization.d.ts +42 -0
  33. package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +80 -0
  34. package/generated/versions/defold-1.13.0/editor-vm/zip.d.ts +10 -0
  35. package/generated/versions/defold-1.13.0/editor-vm/zlib.d.ts +24 -0
  36. package/generated/versions/defold-1.13.0/editor.d.ts +1092 -0
  37. package/generated/versions/defold-1.13.0/factory.d.ts +123 -0
  38. package/generated/versions/defold-1.13.0/font.d.ts +81 -0
  39. package/generated/versions/defold-1.13.0/go.d.ts +1054 -0
  40. package/generated/versions/defold-1.13.0/graphics.d.ts +321 -0
  41. package/generated/versions/defold-1.13.0/gui.d.ts +2370 -0
  42. package/generated/versions/defold-1.13.0/html5.d.ts +53 -0
  43. package/generated/versions/defold-1.13.0/http.d.ts +84 -0
  44. package/generated/versions/defold-1.13.0/iac.d.ts +18 -0
  45. package/generated/versions/defold-1.13.0/iap.d.ts +60 -0
  46. package/generated/versions/defold-1.13.0/image.d.ts +139 -0
  47. package/generated/versions/defold-1.13.0/index.d.ts +48 -0
  48. package/generated/versions/defold-1.13.0/json.d.ts +76 -0
  49. package/generated/versions/defold-1.13.0/kinds/editor-script.d.ts +13 -0
  50. package/generated/versions/defold-1.13.0/label.d.ts +94 -0
  51. package/generated/versions/defold-1.13.0/liveupdate.d.ts +140 -0
  52. package/generated/versions/defold-1.13.0/material.d.ts +444 -0
  53. package/generated/versions/defold-1.13.0/model.d.ts +246 -0
  54. package/generated/versions/defold-1.13.0/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.13.0/particlefx.d.ts +166 -0
  56. package/generated/versions/defold-1.13.0/physics.d.ts +548 -0
  57. package/generated/versions/defold-1.13.0/profiler.d.ts +233 -0
  58. package/generated/versions/defold-1.13.0/push.d.ts +66 -0
  59. package/generated/versions/defold-1.13.0/render.d.ts +1185 -0
  60. package/generated/versions/defold-1.13.0/resource.d.ts +1530 -0
  61. package/generated/versions/defold-1.13.0/socket.d.ts +795 -0
  62. package/generated/versions/defold-1.13.0/sound.d.ts +291 -0
  63. package/generated/versions/defold-1.13.0/sprite.d.ts +157 -0
  64. package/generated/versions/defold-1.13.0/sys.d.ts +695 -0
  65. package/generated/versions/defold-1.13.0/tilemap.d.ts +195 -0
  66. package/generated/versions/defold-1.13.0/timer.d.ts +114 -0
  67. package/generated/versions/defold-1.13.0/types.d.ts +61 -0
  68. package/generated/versions/defold-1.13.0/vmath.d.ts +806 -0
  69. package/generated/versions/defold-1.13.0/webview.d.ts +68 -0
  70. package/generated/versions/defold-1.13.0/window.d.ts +198 -0
  71. package/generated/versions/defold-1.13.0/zlib.d.ts +40 -0
  72. package/index.d.ts +4 -81
  73. package/package.json +11 -3
  74. package/scripts/import-defold-release.ts +28 -1
  75. package/scripts/sync-api-docs.ts +4 -3
  76. package/src/api-availability.ts +0 -0
  77. package/src/emit-dts.ts +6 -0
  78. package/src/example-store.ts +5 -0
  79. package/src/index.ts +3 -0
  80. package/scripts/lua-types-signature-index.ts +0 -151
@@ -0,0 +1,795 @@
1
+ /** @noSelfInFile */
2
+ declare global {
3
+ /**
4
+ * [LuaSocket](https://github.com/diegonehab/luasocket) is a Lua extension library that provides
5
+ * support for the TCP and UDP transport layers. Defold provides the "socket" namespace in
6
+ * runtime, which contain the core C functionality. Additional LuaSocket support modules for
7
+ * SMTP, HTTP, FTP etc are not part of the core included, but can be easily added to a project
8
+ * and used.
9
+ *
10
+ * [icon:html5] On HTML5, the non-network helpers remain available, but TCP, UDP and
11
+ * `socket.select()` are not supported.
12
+ *
13
+ * Note the included helper module "socket.lua" in "builtins/scripts/socket.lua". Require this
14
+ * module to add some additional functions and shortcuts to the namespace:
15
+ *
16
+ * ```lua
17
+ * require "builtins.scripts.socket"
18
+ * ```
19
+ *
20
+ * LuaSocket is Copyright © 2004-2007 Diego Nehab. All rights reserved.
21
+ * LuaSocket is free software, released under the MIT license (same license as the Lua core).
22
+ */
23
+ namespace socket {
24
+ interface client {
25
+ /**
26
+ * Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
27
+ * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
28
+ */
29
+ close(): void;
30
+ /**
31
+ * Check the read buffer status.
32
+ * This is an internal method, any use is unlikely to be portable.
33
+ *
34
+ * @returns `true` if there is any data in the read buffer, `false` otherwise.
35
+ */
36
+ dirty(): boolean;
37
+ /**
38
+ * Returns the underlying socket descriptor or handle associated to the object.
39
+ * This is an internal method, any use is unlikely to be portable.
40
+ *
41
+ * @returns the descriptor or handle. In case the object has been closed, the return will be -1.
42
+ */
43
+ getfd(): number;
44
+ /**
45
+ * Gets options for the TCP object. See client:setoption for description of the option names and values.
46
+ *
47
+ * @param option - the name of the option to get:
48
+ *
49
+ * - `"keepalive"`
50
+ *
51
+ * - `"linger"`
52
+ *
53
+ * - `"reuseaddr"`
54
+ *
55
+ * - `"tcp-nodelay"`
56
+ */
57
+ getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
58
+ /**
59
+ * Returns information about the remote side of a connected client object.
60
+ * It makes no sense to call this method on server objects.
61
+ *
62
+ * @returns a string with the IP address of the peer, the port number that peer is using for the connection, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
63
+ */
64
+ getpeername(): string;
65
+ /**
66
+ * Returns the local address information associated to the object.
67
+ *
68
+ * @returns a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
69
+ */
70
+ getsockname(): string;
71
+ /**
72
+ * Returns accounting information on the socket, useful for throttling of bandwidth.
73
+ *
74
+ * @returns a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
75
+ */
76
+ getstats(): string;
77
+ /**
78
+ * Reads data from a client object, according to the specified `read pattern`. Patterns follow the Lua file I/O format, and the difference in performance between patterns is negligible.
79
+ *
80
+ * @param pattern - the read pattern that can be any of the following:
81
+ *
82
+ * `"*a"`
83
+ * reads from the socket until the connection is closed. No end-of-line translation is performed;
84
+ * `"*l"`
85
+ * reads a line of text from the socket. The line is terminated by a LF character (ASCII 10), optionally preceded by a CR character (ASCII 13). The CR and LF characters are not included in the returned line. In fact, all CR characters are ignored by the pattern. This is the default pattern;
86
+ * `number`
87
+ * causes the method to read a specified number of bytes from the socket.
88
+ * @param prefix - an optional string to be concatenated to the beginning of any received data before return.
89
+ */
90
+ receive(pattern?: string | number, prefix?: string): LuaMultiReturn<[string | undefined, string | undefined, string | undefined]>;
91
+ /**
92
+ * Sends data through client object.
93
+ * The optional arguments i and j work exactly like the standard string.sub Lua function to allow the selection of a substring to be sent.
94
+ * Output is not buffered. For small strings, it is always better to concatenate them in Lua (with the `..` operator) and send the result in one call instead of calling the method several times.
95
+ *
96
+ * @param data - the string to be sent.
97
+ * @param i - optional starting index of the string.
98
+ * @param j - optional end index of string.
99
+ */
100
+ send(data: string, i?: number, j?: number): LuaMultiReturn<[number | undefined, string | undefined, number | undefined]>;
101
+ /**
102
+ * Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
103
+ *
104
+ * @param handle - the descriptor or handle to set.
105
+ */
106
+ setfd(handle: number): void;
107
+ /**
108
+ * Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
109
+ *
110
+ * @param option - the name of the option to set. The value is provided in the `value` parameter:
111
+ *
112
+ * `"keepalive"`
113
+ * Setting this option to `true` enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;
114
+ * `"linger"`
115
+ * Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with the following keys:
116
+ *
117
+ * - boolean `on`
118
+ *
119
+ * - number `timeout` (seconds)
120
+ *
121
+ * If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until `timeout` has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. It is not advised to set this to anything other than zero;
122
+ *
123
+ * `"reuseaddr"`
124
+ * Setting this option indicates that the rules used in validating addresses supplied in a call to `bind` should allow reuse of local addresses;
125
+ * `"tcp-nodelay"`
126
+ * Setting this option to `true` disables the Nagle's algorithm for the connection;
127
+ * `"ipv6-v6only"`
128
+ * Setting this option to `true` restricts an inet6 socket to sending and receiving only IPv6 packets.
129
+ * @param value - the value to set for the specified option.
130
+ */
131
+ setoption(option: string, value?: unknown): LuaMultiReturn<[number | undefined, string | undefined]>;
132
+ /**
133
+ * Resets accounting information on the socket, useful for throttling of bandwidth.
134
+ *
135
+ * @param received - the new number of bytes received.
136
+ * @param sent - the new number of bytes sent.
137
+ * @param age - the new age in seconds.
138
+ * @returns the value `1` in case of success, or `nil` in case of error.
139
+ */
140
+ setstats(received: number, sent: number, age: number): number | undefined;
141
+ /**
142
+ * Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods `send`, `receive`, and `accept` will block indefinitely, until the operation completes. The `settimeout` method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
143
+ * There are two timeout modes and both can be used together for fine tuning.
144
+ * Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
145
+ *
146
+ * @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
147
+ * @param mode - optional timeout mode to set:
148
+ *
149
+ * `"b"`
150
+ * block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;
151
+ * `"t"`
152
+ * total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.
153
+ */
154
+ settimeout(value: number, mode?: string): void;
155
+ /**
156
+ * Shuts down part of a full-duplex connection.
157
+ *
158
+ * @param mode - which way of the connection should be shut down:
159
+ *
160
+ * `"both"`
161
+ * disallow further sends and receives on the object. This is the default mode;
162
+ * `"send"`
163
+ * disallow further sends on the object;
164
+ * `"receive"`
165
+ * disallow further receives on the object.
166
+ * @returns the value `1`.
167
+ */
168
+ shutdown(mode: string): number;
169
+ }
170
+ interface connected {
171
+ /**
172
+ * Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
173
+ * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
174
+ */
175
+ close(): void;
176
+ /**
177
+ * Gets an option value from the UDP object. See connected:setoption for description of the option names and values.
178
+ *
179
+ * @param option - the name of the option to get:
180
+ *
181
+ * - `"dontroute"`
182
+ *
183
+ * - `"broadcast"`
184
+ *
185
+ * - `"reuseaddr"`
186
+ *
187
+ * - `"reuseport"`
188
+ *
189
+ * - `"ip-multicast-loop"`
190
+ *
191
+ * - `"ipv6-v6only"`
192
+ *
193
+ * - `"ip-multicast-if"`
194
+ *
195
+ * - `"ip-multicast-ttl"`
196
+ *
197
+ * - `"ip-add-membership"`
198
+ *
199
+ * - `"ip-drop-membership"`
200
+ */
201
+ getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
202
+ /**
203
+ * Retrieves information about the peer associated with a connected UDP object.
204
+ * It makes no sense to call this method on unconnected objects.
205
+ *
206
+ * @returns a string with the IP address of the peer, the port number that peer is using for the connection, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
207
+ */
208
+ getpeername(): string;
209
+ /**
210
+ * Returns the local address information associated to the object.
211
+ * UDP sockets are not bound to any address until the `setsockname` or the `sendto` method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).
212
+ *
213
+ * @returns a string with local IP address, a number with the local port, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
214
+ */
215
+ getsockname(): string;
216
+ /**
217
+ * Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.
218
+ *
219
+ * @param size - optional maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).
220
+ */
221
+ receive(size?: number): LuaMultiReturn<[string | undefined, string | undefined]>;
222
+ /**
223
+ * Sends a datagram to the UDP peer of a connected object.
224
+ * In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).
225
+ *
226
+ * @param datagram - a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.
227
+ */
228
+ send(datagram: string): LuaMultiReturn<[number | undefined, string | undefined]>;
229
+ /**
230
+ * Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
231
+ *
232
+ * @param option - the name of the option to set. The value is provided in the `value` parameter:
233
+ *
234
+ * `"dontroute"`
235
+ * Indicates that outgoing messages should bypass the standard routing facilities. Receives a boolean value;
236
+ * `"broadcast"`
237
+ * Requests permission to send broadcast datagrams on the socket. Receives a boolean value;
238
+ * `"reuseaddr"`
239
+ * Indicates that the rules used in validating addresses supplied in a `bind` call should allow reuse of local addresses. Receives a boolean value;
240
+ * `"reuseport"`
241
+ * Allows completely duplicate bindings by multiple processes if they all set `"reuseport"` before binding the port. Receives a boolean value;
242
+ * `"ip-multicast-loop"`
243
+ * Specifies whether or not a copy of an outgoing multicast datagram is delivered to the sending host as long as it is a member of the multicast group. Receives a boolean value;
244
+ * `"ipv6-v6only"`
245
+ * Specifies whether to restrict inet6 sockets to sending and receiving only IPv6 packets. Receive a boolean value;
246
+ * `"ip-multicast-if"`
247
+ * Sets the interface over which outgoing multicast datagrams are sent. Receives an IP address;
248
+ * `"ip-multicast-ttl"`
249
+ * Sets the Time To Live in the IP header for outgoing multicast datagrams. Receives a number;
250
+ *
251
+ * `"ip-add-membership"`: Joins the multicast group specified. Receives a table with fields:
252
+ *
253
+ * - string `multiaddr` (IP address)
254
+ *
255
+ * - string `interface` (IP address)
256
+ *
257
+ * "'ip-drop-membership"`
258
+ * Leaves the multicast group specified. Receives a table with fields:
259
+ *
260
+ * - string `multiaddr` (IP address)
261
+ *
262
+ * - string `interface` (IP address)
263
+ * @param value - the value to set for the specified option.
264
+ */
265
+ setoption(option: string, value?: unknown): LuaMultiReturn<[number | undefined, string | undefined]>;
266
+ /**
267
+ * Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
268
+ * For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the `send` and `receive` methods instead of `sendto` and `receivefrom`.
269
+ * Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
270
+ *
271
+ * @param arg0 - if address is "*" and the object is connected, the peer association is removed and the object becomes an unconnected object again.
272
+ */
273
+ setpeername(arg0: string): LuaMultiReturn<[number | undefined, string | undefined]>;
274
+ /**
275
+ * Changes the timeout values for the object. By default, the `receive` and `receivefrom` operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The `settimeout` function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
276
+ * In UDP, the `send` and `sendto` methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the `settimeout` method has no effect on them.
277
+ *
278
+ * @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
279
+ */
280
+ settimeout(value: number): void;
281
+ }
282
+ interface master {
283
+ /**
284
+ * Binds a master object to address and port on the local host.
285
+ *
286
+ * @param address - an IP address or a host name. If address is `"*"`, the system binds to all local interfaces using the `INADDR_ANY` constant.
287
+ * @param port - the port to commect to, in the range [0..64K). If port is 0, the system automatically chooses an ephemeral port.
288
+ */
289
+ bind(address: string, port: number): LuaMultiReturn<[number | undefined, string | undefined]>;
290
+ /**
291
+ * Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
292
+ * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
293
+ */
294
+ close(): void;
295
+ /**
296
+ * Attempts to connect a master object to a remote host, transforming it into a client object. Client objects support methods send, receive, getsockname, getpeername, settimeout, and close.
297
+ * Note that the function `socket.connect` is available and is a shortcut for the creation of client sockets.
298
+ *
299
+ * @param address - an IP address or a host name. If address is `"*"`, the system binds to all local interfaces using the `INADDR_ANY` constant.
300
+ * @param port - the port to commect to, in the range [0..64K). If port is 0, the system automatically chooses an ephemeral port.
301
+ */
302
+ connect(address: string, port: number): LuaMultiReturn<[number | undefined, string | undefined]>;
303
+ /**
304
+ * Check the read buffer status.
305
+ * This is an internal method, any use is unlikely to be portable.
306
+ *
307
+ * @returns `true` if there is any data in the read buffer, `false` otherwise.
308
+ */
309
+ dirty(): boolean;
310
+ /**
311
+ * Returns the underlying socket descriptor or handle associated to the object.
312
+ * This is an internal method, any use is unlikely to be portable.
313
+ *
314
+ * @returns the descriptor or handle. In case the object has been closed, the return will be -1.
315
+ */
316
+ getfd(): number;
317
+ /**
318
+ * Returns the local address information associated to the object.
319
+ *
320
+ * @returns a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
321
+ */
322
+ getsockname(): string;
323
+ /**
324
+ * Returns accounting information on the socket, useful for throttling of bandwidth.
325
+ *
326
+ * @returns a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
327
+ */
328
+ getstats(): string;
329
+ /**
330
+ * Specifies the socket is willing to receive connections, transforming the object into a server object. Server objects support the `accept`, `getsockname`, `setoption`, `settimeout`, and `close` methods.
331
+ *
332
+ * @param backlog - the number of client connections that can be queued waiting for service. If the queue is full and another client attempts connection, the connection is refused.
333
+ */
334
+ listen(backlog: number): LuaMultiReturn<[number | undefined, string | undefined]>;
335
+ /**
336
+ * Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
337
+ *
338
+ * @param handle - the descriptor or handle to set.
339
+ */
340
+ setfd(handle: number): void;
341
+ /**
342
+ * Resets accounting information on the socket, useful for throttling of bandwidth.
343
+ *
344
+ * @param received - the new number of bytes received.
345
+ * @param sent - the new number of bytes sent.
346
+ * @param age - the new age in seconds.
347
+ * @returns the value `1` in case of success, or `nil` in case of error.
348
+ */
349
+ setstats(received: number, sent: number, age: number): number | undefined;
350
+ /**
351
+ * Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods `send`, `receive`, and `accept` will block indefinitely, until the operation completes. The `settimeout` method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
352
+ * There are two timeout modes and both can be used together for fine tuning.
353
+ * Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
354
+ *
355
+ * @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
356
+ * @param mode - optional timeout mode to set:
357
+ *
358
+ * `"b"`
359
+ * block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;
360
+ * `"t"`
361
+ * total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.
362
+ */
363
+ settimeout(value: number, mode?: string): void;
364
+ }
365
+ interface server {
366
+ /**
367
+ * Waits for a remote connection on the server object and returns a client object representing that connection.
368
+ * Calling `socket.select` with a server object in the `recvt` parameter before a call to accept does not guarantee accept will return immediately. Use the `settimeout` method or accept might block until another client shows up.
369
+ */
370
+ accept(): LuaMultiReturn<[client | undefined, string | undefined]>;
371
+ /**
372
+ * Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
373
+ * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
374
+ */
375
+ close(): void;
376
+ /**
377
+ * Check the read buffer status.
378
+ * This is an internal method, any use is unlikely to be portable.
379
+ *
380
+ * @returns `true` if there is any data in the read buffer, `false` otherwise.
381
+ */
382
+ dirty(): boolean;
383
+ /**
384
+ * Returns the underlying socket descriptor or handle associated to the object.
385
+ * This is an internal method, any use is unlikely to be portable.
386
+ *
387
+ * @returns the descriptor or handle. In case the object has been closed, the return will be -1.
388
+ */
389
+ getfd(): number;
390
+ /**
391
+ * Gets options for the TCP object. See server:setoption for description of the option names and values.
392
+ *
393
+ * @param option - the name of the option to get:
394
+ *
395
+ * - `"keepalive"`
396
+ *
397
+ * - `"linger"`
398
+ *
399
+ * - `"reuseaddr"`
400
+ *
401
+ * - `"tcp-nodelay"`
402
+ */
403
+ getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
404
+ /**
405
+ * Returns the local address information associated to the object.
406
+ *
407
+ * @returns a string with local IP address, the local port number, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
408
+ */
409
+ getsockname(): string;
410
+ /**
411
+ * Returns accounting information on the socket, useful for throttling of bandwidth.
412
+ *
413
+ * @returns a string with the number of bytes received, the number of bytes sent, and the age of the socket object in seconds.
414
+ */
415
+ getstats(): string;
416
+ /**
417
+ * Sets the underling socket descriptor or handle associated to the object. The current one is simply replaced, not closed, and no other change to the object state is made
418
+ *
419
+ * @param handle - the descriptor or handle to set.
420
+ */
421
+ setfd(handle: number): void;
422
+ /**
423
+ * Sets options for the TCP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
424
+ *
425
+ * @param option - the name of the option to set. The value is provided in the `value` parameter:
426
+ *
427
+ * `"keepalive"`
428
+ * Setting this option to `true` enables the periodic transmission of messages on a connected socket. Should the connected party fail to respond to these messages, the connection is considered broken and processes using the socket are notified;
429
+ * `"linger"`
430
+ * Controls the action taken when unsent data are queued on a socket and a close is performed. The value is a table with the following keys:
431
+ *
432
+ * - boolean `on`
433
+ *
434
+ * - number `timeout` (seconds)
435
+ *
436
+ * If the 'on' field is set to true, the system will block the process on the close attempt until it is able to transmit the data or until `timeout` has passed. If 'on' is false and a close is issued, the system will process the close in a manner that allows the process to continue as quickly as possible. It is not advised to set this to anything other than zero;
437
+ *
438
+ * `"reuseaddr"`
439
+ * Setting this option indicates that the rules used in validating addresses supplied in a call to `bind` should allow reuse of local addresses;
440
+ * `"tcp-nodelay"`
441
+ * Setting this option to `true` disables the Nagle's algorithm for the connection;
442
+ * `"ipv6-v6only"`
443
+ * Setting this option to `true` restricts an inet6 socket to sending and receiving only IPv6 packets.
444
+ * @param value - the value to set for the specified option.
445
+ */
446
+ setoption(option: string, value?: unknown): LuaMultiReturn<[number | undefined, string | undefined]>;
447
+ /**
448
+ * Resets accounting information on the socket, useful for throttling of bandwidth.
449
+ *
450
+ * @param received - the new number of bytes received.
451
+ * @param sent - the new number of bytes sent.
452
+ * @param age - the new age in seconds.
453
+ * @returns the value `1` in case of success, or `nil` in case of error.
454
+ */
455
+ setstats(received: number, sent: number, age: number): number | undefined;
456
+ /**
457
+ * Changes the timeout values for the object. By default, all I/O operations are blocking. That is, any call to the methods `send`, `receive`, and `accept` will block indefinitely, until the operation completes. The `settimeout` method defines a limit on the amount of time the I/O methods can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
458
+ * There are two timeout modes and both can be used together for fine tuning.
459
+ * Although timeout values have millisecond precision in LuaSocket, large blocks can cause I/O functions not to respect timeout values due to the time the library takes to transfer blocks to and from the OS and to and from the Lua interpreter. Also, function that accept host names and perform automatic name resolution might be blocked by the resolver for longer than the specified timeout value.
460
+ *
461
+ * @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
462
+ * @param mode - optional timeout mode to set:
463
+ *
464
+ * `"b"`
465
+ * block timeout. Specifies the upper limit on the amount of time LuaSocket can be blocked by the operating system while waiting for completion of any single I/O operation. This is the default mode;
466
+ * `"t"`
467
+ * total timeout. Specifies the upper limit on the amount of time LuaSocket can block a Lua script before returning from a call.
468
+ */
469
+ settimeout(value: number, mode?: string): void;
470
+ }
471
+ interface unconnected {
472
+ /**
473
+ * Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
474
+ * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
475
+ */
476
+ close(): void;
477
+ /**
478
+ * Gets an option value from the UDP object. See unconnected:setoption for description of the option names and values.
479
+ *
480
+ * @param option - the name of the option to get:
481
+ *
482
+ * - `"dontroute"`
483
+ *
484
+ * - `"broadcast"`
485
+ *
486
+ * - `"reuseaddr"`
487
+ *
488
+ * - `"reuseport"`
489
+ *
490
+ * - `"ip-multicast-loop"`
491
+ *
492
+ * - `"ipv6-v6only"`
493
+ *
494
+ * - `"ip-multicast-if"`
495
+ *
496
+ * - `"ip-multicast-ttl"`
497
+ *
498
+ * - `"ip-add-membership"`
499
+ *
500
+ * - `"ip-drop-membership"`
501
+ */
502
+ getoption(option: string): LuaMultiReturn<[unknown, string | undefined]>;
503
+ /**
504
+ * Returns the local address information associated to the object.
505
+ * UDP sockets are not bound to any address until the `setsockname` or the `sendto` method is called for the first time (in which case it is bound to an ephemeral port and the wild-card address).
506
+ *
507
+ * @returns a string with local IP address, a number with the local port, and the family ("inet" or "inet6"). In case of error, the method returns `nil`.
508
+ */
509
+ getsockname(): string;
510
+ /**
511
+ * Receives a datagram from the UDP object. If the UDP object is connected, only datagrams coming from the peer are accepted. Otherwise, the returned datagram can come from any host.
512
+ *
513
+ * @param size - optional maximum size of the datagram to be retrieved. If there are more than size bytes available in the datagram, the excess bytes are discarded. If there are less then size bytes available in the current datagram, the available bytes are returned. If size is omitted, the maximum datagram size is used (which is currently limited by the implementation to 8192 bytes).
514
+ */
515
+ receive(size?: number): LuaMultiReturn<[string | undefined, string | undefined]>;
516
+ /**
517
+ * Works exactly as the receive method, except it returns the IP address and port as extra return values (and is therefore slightly less efficient).
518
+ *
519
+ * @param size - optional maximum size of the datagram to be retrieved.
520
+ */
521
+ receivefrom(size?: number): LuaMultiReturn<[string | undefined, string, number | undefined]>;
522
+ /**
523
+ * Sends a datagram to the specified IP address and port number.
524
+ * In UDP, the send method never blocks and the only way it can fail is if the underlying transport layer refuses to send a message to the specified address (i.e. no interface accepts the address).
525
+ *
526
+ * @param datagram - a string with the datagram contents. The maximum datagram size for UDP is 64K minus IP layer overhead. However datagrams larger than the link layer packet size will be fragmented, which may deteriorate performance and/or reliability.
527
+ * @param ip - the IP address of the recipient. Host names are not allowed for performance reasons.
528
+ * @param port - the port number at the recipient.
529
+ */
530
+ sendto(datagram: string, ip: string, port: number): LuaMultiReturn<[number | undefined, string | undefined]>;
531
+ /**
532
+ * Sets options for the UDP object. Options are only needed by low-level or time-critical applications. You should only modify an option if you are sure you need it.
533
+ *
534
+ * @param option - the name of the option to set. The value is provided in the `value` parameter:
535
+ *
536
+ * `"dontroute"`
537
+ * Indicates that outgoing messages should bypass the standard routing facilities. Receives a boolean value;
538
+ * `"broadcast"`
539
+ * Requests permission to send broadcast datagrams on the socket. Receives a boolean value;
540
+ * `"reuseaddr"`
541
+ * Indicates that the rules used in validating addresses supplied in a `bind` call should allow reuse of local addresses. Receives a boolean value;
542
+ * `"reuseport"`
543
+ * Allows completely duplicate bindings by multiple processes if they all set `"reuseport"` before binding the port. Receives a boolean value;
544
+ * `"ip-multicast-loop"`
545
+ * Specifies whether or not a copy of an outgoing multicast datagram is delivered to the sending host as long as it is a member of the multicast group. Receives a boolean value;
546
+ * `"ipv6-v6only"`
547
+ * Specifies whether to restrict inet6 sockets to sending and receiving only IPv6 packets. Receive a boolean value;
548
+ * `"ip-multicast-if"`
549
+ * Sets the interface over which outgoing multicast datagrams are sent. Receives an IP address;
550
+ * `"ip-multicast-ttl"`
551
+ * Sets the Time To Live in the IP header for outgoing multicast datagrams. Receives a number;
552
+ *
553
+ * `"ip-add-membership"`: Joins the multicast group specified. Receives a table with fields:
554
+ *
555
+ * - string `multiaddr` (IP address)
556
+ *
557
+ * - string `interface` (IP address)
558
+ *
559
+ * "'ip-drop-membership"`
560
+ * Leaves the multicast group specified. Receives a table with fields:
561
+ *
562
+ * - string `multiaddr` (IP address)
563
+ *
564
+ * - string `interface` (IP address)
565
+ * @param value - the value to set for the specified option.
566
+ */
567
+ setoption(option: string, value?: unknown): LuaMultiReturn<[number | undefined, string | undefined]>;
568
+ /**
569
+ * Changes the peer of a UDP object. This method turns an unconnected UDP object into a connected UDP object or vice versa.
570
+ * For connected objects, outgoing datagrams will be sent to the specified peer, and datagrams received from other peers will be discarded by the OS. Connected UDP objects must use the `send` and `receive` methods instead of `sendto` and `receivefrom`.
571
+ * Since the address of the peer does not have to be passed to and from the OS, the use of connected UDP objects is recommended when the same peer is used for several transmissions and can result in up to 30% performance gains.
572
+ *
573
+ * @param address - an IP address or a host name.
574
+ * @param port - the port number.
575
+ */
576
+ setpeername(address: string, port: number): LuaMultiReturn<[number | undefined, string | undefined]>;
577
+ /**
578
+ * Binds the UDP object to a local address.
579
+ * This method can only be called before any datagram is sent through the UDP object, and only once. Otherwise, the system automatically binds the object to all local interfaces and chooses an ephemeral port as soon as the first datagram is sent. After the local address is set, either automatically by the system or explicitly by `setsockname`, it cannot be changed.
580
+ *
581
+ * @param address - an IP address or a host name. If address is "*" the system binds to all local interfaces using the constant `INADDR_ANY`.
582
+ * @param port - the port number. If port is 0, the system chooses an ephemeral port.
583
+ */
584
+ setsockname(address: string, port: number): LuaMultiReturn<[number | undefined, string | undefined]>;
585
+ /**
586
+ * Changes the timeout values for the object. By default, the `receive` and `receivefrom` operations are blocking. That is, any call to the methods will block indefinitely, until data arrives. The `settimeout` function defines a limit on the amount of time the functions can block. When a timeout is set and the specified amount of time has elapsed, the affected methods give up and fail with an error code.
587
+ * In UDP, the `send` and `sendto` methods never block (the datagram is just passed to the OS and the call returns immediately). Therefore, the `settimeout` method has no effect on them.
588
+ *
589
+ * @param value - the amount of time to wait, in seconds. The `nil` timeout value allows operations to block indefinitely. Negative timeout values have the same effect.
590
+ */
591
+ settimeout(value: number): void;
592
+ }
593
+ /**
594
+ * This constant contains the maximum number of sockets that the select function can handle.
595
+ */
596
+ const _SETSIZE: number & { readonly __brand: "socket._SETSIZE" };
597
+ /**
598
+ * This constant has a string describing the current LuaSocket version.
599
+ */
600
+ const _VERSION: number & { readonly __brand: "socket._VERSION" };
601
+ /**
602
+ * This function is a shortcut that creates and returns a TCP client object connected to a remote
603
+ * address at a given port. Optionally, the user can also specify the local address and port to
604
+ * bind (`locaddr` and `locport`), or restrict the socket family to `"inet"` or `"inet6"`.
605
+ * Without specifying family to connect, whether a tcp or tcp6 connection is created depends on
606
+ * your system configuration.
607
+ *
608
+ * @param address - the address to connect to.
609
+ * @param port - the port to connect to.
610
+ * @param locaddr - optional local address to bind to.
611
+ * @param locport - optional local port to bind to.
612
+ * @param family - optional socket family to use, `"inet"` or `"inet6"`.
613
+ */
614
+ function connect(address: string, port: number, locaddr?: string, locport?: number, family?: string): LuaMultiReturn<[client | undefined, string | undefined]>;
615
+ /**
616
+ * Returns the time in seconds, relative to the system epoch (Unix epoch time since January 1, 1970 (UTC) or Windows file time since January 1, 1601 (UTC)).
617
+ * You should use the values returned by this function for relative measurements only.
618
+ *
619
+ * @returns the number of seconds elapsed.
620
+ * @example
621
+ * ```ts
622
+ * // How to use the gettime() function to measure running time:
623
+ * const t = socket.gettime();
624
+ * // do stuff
625
+ * print(`${socket.gettime() - t} seconds elapsed`);
626
+ * ```
627
+ */
628
+ function gettime(): number;
629
+ /**
630
+ * This function creates and returns a clean try function that allows for cleanup before the exception is raised.
631
+ * The `finalizer` function will be called in protected mode (see protect).
632
+ *
633
+ * @param finalizer - a function that will be called before the try throws the exception.
634
+ * @returns the customized try function.
635
+ * @example
636
+ * ```ts
637
+ * // Perform operations on an open socket c:
638
+ * // create a try function that closes 'c' on error
639
+ * const try_ = socket.newtry(() => c.close());
640
+ * // do everything reassured c will be closed
641
+ * try_(c.send("hello there?\r\n"));
642
+ * const answer = try_(c.receive());
643
+ * // ...
644
+ * try_(c.send("good bye\r\n"));
645
+ * c.close();
646
+ * ```
647
+ */
648
+ function newtry(finalizer: () => void): (...args: unknown[]) => unknown;
649
+ /**
650
+ * Converts a function that throws exceptions into a safe function. This function only catches exceptions thrown by try functions. It does not catch normal Lua errors.
651
+ * Beware that if your function performs some illegal operation that raises an error, the protected function will catch the error and return it as a string. This is because try functions uses errors as the mechanism to throw exceptions.
652
+ *
653
+ * @param func - a function that calls a try function (or assert, or error) to throw exceptions.
654
+ * @returns an equivalent function that instead of throwing exceptions, returns `nil` followed by an error message.
655
+ * @example
656
+ * ```ts
657
+ * const dostuff = socket.protect(() => {
658
+ * let try_ = socket.newtry();
659
+ * const c = try_(socket.connect("myserver.com", 80));
660
+ * try_ = socket.newtry(() => c.close());
661
+ * try_(c.send("hello?\r\n"));
662
+ * const answer = try_(c.receive());
663
+ * c.close();
664
+ * });
665
+ *
666
+ * const [n, error] = dostuff();
667
+ * ```
668
+ */
669
+ function protect(func: (...args: unknown[]) => unknown): (arg0: unknown) => void;
670
+ /**
671
+ * The function returns a list with the sockets ready for reading, a list with the sockets ready for writing and an error message. The error message is "timeout" if a timeout condition was met and nil otherwise. The returned tables are doubly keyed both by integers and also by the sockets themselves, to simplify the test if a specific socket has changed status.
672
+ * `Recvt` and `sendt` parameters can be empty tables or `nil`. Non-socket values (or values with non-numeric indices) in these arrays will be silently ignored.
673
+ * The returned tables are doubly keyed both by integers and also by the sockets themselves, to simplify the test if a specific socket has changed status.
674
+ * This function can monitor a limited number of sockets, as defined by the constant socket._SETSIZE. This number may be as high as 1024 or as low as 64 by default, depending on the system. It is usually possible to change this at compile time. Invoking select with a larger number of sockets will raise an error.
675
+ * A known bug in WinSock causes select to fail on non-blocking TCP sockets. The function may return a socket as writable even though the socket is not ready for sending.
676
+ * Calling select with a server socket in the receive parameter before a call to accept does not guarantee accept will return immediately. Use the settimeout method or accept might block forever.
677
+ * If you close a socket and pass it to select, it will be ignored.
678
+ * (Using select with non-socket objects: Any object that implements `getfd` and `dirty` can be used with select, allowing objects from other libraries to be used within a socket.select driven loop.)
679
+ *
680
+ * @param recvt - array with the sockets to test for characters available for reading.
681
+ * @param sendt - array with sockets that are watched to see if it is OK to immediately write on them.
682
+ * @param timeout - the maximum amount of time (in seconds) to wait for a change in status. Nil, negative or omitted timeout value allows the function to block indefinitely.
683
+ */
684
+ function select(recvt: (client | master | unconnected)[], sendt: (client | master | unconnected)[], timeout?: number): LuaMultiReturn<[(client | master | unconnected)[], (client | master | unconnected)[], string | undefined]>;
685
+ /**
686
+ * This function drops a number of arguments and returns the remaining.
687
+ * It is useful to avoid creation of dummy variables:
688
+ * `D` is the number of arguments to drop. `Ret1` to `retN` are the arguments.
689
+ * The function returns `retD+1` to `retN`.
690
+ *
691
+ * @param d - the number of arguments to drop.
692
+ * @param ret1 - argument 1.
693
+ * @param ret2 - argument 2.
694
+ * @param retN - argument N.
695
+ * @example
696
+ * ```ts
697
+ * // Instead of doing the following with dummy variables:
698
+ * // get the status code and separator from SMTP server reply
699
+ * const [dummy1, dummy2, code, sep] = string.find(line, "^(%d%d%d)(.?)");
700
+ *
701
+ * // You can skip a number of variables:
702
+ * // get the status code and separator from SMTP server reply
703
+ * const [code, sep] = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"));
704
+ * ```
705
+ */
706
+ function skip(d: number, ret1?: unknown, ret2?: unknown, retN?: unknown): LuaMultiReturn<[unknown, unknown, unknown]>;
707
+ /**
708
+ * Freezes the program execution during a given amount of time.
709
+ *
710
+ * @param time - the number of seconds to sleep for.
711
+ */
712
+ function sleep(time: number): void;
713
+ /**
714
+ * Creates and returns an IPv4 TCP master object. A master object can be transformed into a server object with the method `listen` (after a call to `bind`) or into a client object with the method `connect`. The only other method supported by a master object is the `close` method.
715
+ */
716
+ function tcp(): LuaMultiReturn<[master | undefined, string | undefined]>;
717
+ /**
718
+ * Creates and returns an IPv6 TCP master object. A master object can be transformed into a server object with the method `listen` (after a call to `bind`) or into a client object with the method connect. The only other method supported by a master object is the close method.
719
+ * Note: The TCP object returned will have the option "ipv6-v6only" set to true.
720
+ */
721
+ function tcp6(): LuaMultiReturn<[master | undefined, string | undefined]>;
722
+ /**
723
+ * Creates and returns an unconnected IPv4 UDP object. Unconnected objects support the `sendto`, `receive`, `receivefrom`, `getoption`, `getsockname`, `setoption`, `settimeout`, `setpeername`, `setsockname`, and `close` methods. The `setpeername` method is used to connect the object.
724
+ */
725
+ function udp(): LuaMultiReturn<[unconnected | undefined, string | undefined]>;
726
+ /**
727
+ * Creates and returns an unconnected IPv6 UDP object. Unconnected objects support the `sendto`, `receive`, `receivefrom`, `getoption`, `getsockname`, `setoption`, `settimeout`, `setpeername`, `setsockname`, and `close` methods. The `setpeername` method is used to connect the object.
728
+ * Note: The UDP object returned will have the option "ipv6-v6only" set to true.
729
+ */
730
+ function udp6(): LuaMultiReturn<[unconnected | undefined, string | undefined]>;
731
+ namespace dns {
732
+ /**
733
+ * This function converts a host name to IPv4 or IPv6 address.
734
+ * The supplied address can be an IPv4 or IPv6 address or host name.
735
+ * The function returns a table with all information returned by the resolver:
736
+ *
737
+ * `{
738
+ * [1] = {
739
+ * family = family-name-1,
740
+ * addr = address-1
741
+ * },
742
+ * ...
743
+ * [n] = {
744
+ * family = family-name-n,
745
+ * addr = address-n
746
+ * }
747
+ * }
748
+ * `
749
+ *
750
+ * Here, family contains the string `"inet"` for IPv4 addresses, and `"inet6"` for IPv6 addresses.
751
+ * In case of error, the function returns nil followed by an error message.
752
+ *
753
+ * @param address - a hostname or an IPv4 or IPv6 address.
754
+ */
755
+ function getaddrinfo(address: string): LuaMultiReturn<[Record<string | number, unknown> | undefined, string | undefined]>;
756
+ /**
757
+ * Returns the standard host name for the machine as a string.
758
+ *
759
+ * @returns the host name for the machine.
760
+ */
761
+ function gethostname(): string;
762
+ /**
763
+ * This function converts an address to host name.
764
+ * The supplied address can be an IPv4 or IPv6 address or host name.
765
+ * The function returns a table with all information returned by the resolver:
766
+ *
767
+ * `{
768
+ * [1] = host-name-1,
769
+ * ...
770
+ * [n] = host-name-n,
771
+ * }
772
+ * `
773
+ *
774
+ * @param address - a hostname or an IPv4 or IPv6 address.
775
+ */
776
+ function getnameinfo(address: string): LuaMultiReturn<[Record<string | number, unknown> | undefined, string | undefined]>;
777
+ /**
778
+ * This function converts from an IPv4 address to host name.
779
+ * The address can be an IPv4 address or a host name.
780
+ *
781
+ * @param address - an IPv4 address or host name.
782
+ */
783
+ function tohostname(address: string): LuaMultiReturn<[string | undefined, Record<string | number, unknown> | string]>;
784
+ /**
785
+ * This function converts a host name to IPv4 address.
786
+ * The address can be an IP address or a host name.
787
+ *
788
+ * @param address - a hostname or an IP address.
789
+ */
790
+ function toip(address: string): LuaMultiReturn<[string | undefined, Record<string | number, unknown> | string]>;
791
+ }
792
+ }
793
+ }
794
+
795
+ export {};