functions can behave either synchronously or
asynchronously. If a callback is provided to these functions, they behave
asynchronously; if no callback is provided, they behave synchronously.
Pseudo-Types ~
Some unique types are defined. These are not actual types in Lua, but they are
used here to facilitate documenting consistent behavior:
- `fail`: an assertable `nil, string, string` tuple (see |luv-error-handling|)
- `callable`: a `function`; or a `table` or `userdata` with a `__call`
metamethod
- `buffer`: a `string` or a sequential `table` of `string`s
- `threadargs`: variable arguments (`...`) of type `nil`, `boolean`, `number`,
`string`, or `userdata`; number of arguments limited to 9.
==============================================================================
CONTENTS *luv-contents*
This documentation is mostly a retelling of the libuv API documentation
(https://docs.libuv.org/en/v1.x/api.html) within the context of luv's Lua API.
Low-level implementation details and unexposed C functions and types are not
documented here except for when they are relevant to behavior seen in the Lua
module.
- |luv-constants| — Constants
- |luv-error-handling| — Error handling
- |luv-version-checking| — Version checking
- |uv_loop_t| — Event loop
- |uv_req_t| — Base request
- |uv_handle_t| — Base handle
- |uv_timer_t| — Timer handle
- |uv_prepare_t| — Prepare handle
- |uv_check_t| — Check handle
- |uv_idle_t| — Idle handle
- |uv_async_t| — Async handle
- |uv_poll_t| — Poll handle
- |uv_signal_t| — Signal handle
- |uv_process_t| — Process handle
- |uv_stream_t| — Stream handle
- |uv_tcp_t| — TCP handle
- |uv_pipe_t| — Pipe handle
- |uv_tty_t| — TTY handle
- |uv_udp_t| — UDP handle
- |uv_fs_event_t| — FS Event handle
- |uv_fs_poll_t| — FS Poll handle
- |luv-file-system-operations| — File system operations
- |luv-thread-pool-work-scheduling| — Thread pool work scheduling
- |luv-dns-utility-functions| — DNS utility functions
- |luv-threading-and-synchronization-utilities| — Threading and
synchronization utilities
- |luv-miscellaneous-utilities| — Miscellaneous utilities
- |luv-metrics-operations| — Metrics operations
==============================================================================
CONSTANTS *luv-constants*
As a Lua library, luv supports and encourages the use of lowercase strings to
represent options. For example:
>lua
-- signal start with string input
uv.signal_start("sigterm", function(signame)
print(signame) -- string output: "sigterm"
end)
<
However, luv also superficially exposes libuv constants in a Lua table at
`uv.constants` where its keys are uppercase constant names and their associated
values are integers defined internally by libuv. The values from this table may
be supported as function arguments, but their use may not change the output
type. For example:
>lua
-- signal start with integer input
uv.signal_start(uv.constants.SIGTERM, function(signame)
print(signame) -- string output: "sigterm"
end)
<
The uppercase constants defined in `uv.constants` that have associated
lowercase option strings are listed below.
Address Families ~
- `AF_UNIX`: "unix"
- `AF_INET`: "inet"
- `AF_INET6`: "inet6"
- `AF_IPX`: "ipx"
- `AF_NETLINK`: "netlink"
- `AF_X25`: "x25"
- `AF_AX25`: "as25"
- `AF_ATMPVC`: "atmpvc"
- `AF_APPLETALK`: "appletalk"
- `AF_PACKET`: "packet"
Signals ~
- `SIGHUP`: "sighup"
- `SIGINT`: "sigint"
- `SIGQUIT`: "sigquit"
- `SIGILL`: "sigill"
- `SIGTRAP`: "sigtrap"
- `SIGABRT`: "sigabrt"
- `SIGIOT`: "sigiot"
- `SIGBUS`: "sigbus"
- `SIGFPE`: "sigfpe"
- `SIGKILL`: "sigkill"
- `SIGUSR1`: "sigusr1"
- `SIGSEGV`: "sigsegv"
- `SIGUSR2`: "sigusr2"
- `SIGPIPE`: "sigpipe"
- `SIGALRM`: "sigalrm"
- `SIGTERM`: "sigterm"
- `SIGCHLD`: "sigchld"
- `SIGSTKFLT`: "sigstkflt"
- `SIGCONT`: "sigcont"
- `SIGSTOP`: "sigstop"
- `SIGTSTP`: "sigtstp"
- `SIGBREAK`: