diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-01-25 18:31:31 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-01-25 18:31:31 +0000 |
commit | 9243becbedbb6a1592208051f8fa2b090dcc5e7d (patch) | |
tree | 607c2a862ec3f4399b8766383f6f8e04c4aa43b4 /runtime/doc/luvref.txt | |
parent | 9e40b6e9e1bc67f2d856adb837ee64dd0e25b717 (diff) | |
parent | 3c48d3c83fc21dbc0841f9210f04bdb073d73cd1 (diff) | |
download | rneovim-usermarks.tar.gz rneovim-usermarks.tar.bz2 rneovim-usermarks.zip |
Merge remote-tracking branch 'upstream/master' into usermarksusermarks
Diffstat (limited to 'runtime/doc/luvref.txt')
-rw-r--r-- | runtime/doc/luvref.txt | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt index ee45444b42..859e75e4af 100644 --- a/runtime/doc/luvref.txt +++ b/runtime/doc/luvref.txt @@ -3,7 +3,7 @@ LUV REFERENCE MANUAL - + *luvref* This file documents the Lua bindings for the LibUV library which is used for Nvim's event-loop and is accessible from Lua via |vim.loop| (e.g., |uv.version()| is exposed as `vim.loop.version()`). @@ -28,7 +28,7 @@ TCP Echo Server Example~ Here is a small example showing a TCP echo server: - > + >lua local uv = vim.loop local server = uv.new_tcp() @@ -97,7 +97,7 @@ used here to facilitate documenting consistent behavior: CONTENTS *luv-contents* This documentation is mostly a retelling of the libuv API documentation -(http://docs.libuv.org/en/v1.x/api.html) within the context of luv's Lua API. +(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. @@ -250,7 +250,7 @@ uv.loop_configure({option}, {...}) *uv.loop_configure()* An example of a valid call to this function is: - > + >lua uv.loop_configure("block_signal", "sigprof") < @@ -343,7 +343,7 @@ uv.walk({callback}) *uv.walk()* Returns: Nothing. - > + >lua -- Example usage of uv.walk to close all handles that -- aren't already closing. uv.walk(function (handle) @@ -613,7 +613,7 @@ uv.new_timer() *uv.new_timer()* Returns: `uv_timer_t userdata` or `fail` - > + >lua -- Creating a simple setTimeout wrapper local function setTimeout(timeout, callback) local timer = uv.new_timer() @@ -737,7 +737,7 @@ uv.timer_get_due_in({timer}) *uv.timer_get_due_in()* Prepare handles will run the given callback once per loop iteration, right before polling for I/O. - > + >lua local prepare = uv.new_prepare() prepare:start(function() print("Before I/O polling") @@ -782,7 +782,7 @@ uv.prepare_stop({prepare}) *uv.prepare_stop()* Check handles will run the given callback once per loop iteration, right after polling for I/O. - > + >lua local check = uv.new_check() check:start(function() print("After I/O polling") @@ -834,7 +834,7 @@ blocking for I/O. WARNING: Despite the name, idle handles will get their callbacks called on every loop iteration, not when the loop is actually "idle". - > + >lua local idle = uv.new_idle() idle:start(function() print("Before I/O polling, no blocking") @@ -879,7 +879,7 @@ uv.idle_stop({check}) *uv.idle_stop()* Async handles allow the user to "wakeup" the event loop and get a callback called from another thread. - > + >lua local async async = uv.new_async(function() print("async operation ran") @@ -933,7 +933,7 @@ uv.async_send({async}, {...}) *uv.async_send()* Poll handles are used to watch file descriptors for readability and writability, similar to the purpose of poll(2) -(http://linux.die.net/man/2/poll). +(https://linux.die.net/man/2/poll). The purpose of poll handles is to enable integrating external libraries that rely on the event loop to signal it about the socket status changes, like @@ -1062,7 +1062,7 @@ Unix Notes: will lead to unpredictable behavior and is strongly discouraged. Future versions of libuv may simply reject them. - > + >lua -- Create a new signal handler local signal = uv.new_signal() -- Define a handler function @@ -1164,7 +1164,7 @@ uv.spawn({path}, {options}, {on_exit}) *uv.spawn()* permissions to use the setuid or setgid specified, or not having enough memory to allocate for the new process. - > + >lua local stdin = uv.new_pipe() local stdout = uv.new_pipe() local stderr = uv.new_pipe() @@ -1358,7 +1358,7 @@ uv.accept({stream}, {client_stream}) *uv.accept()* Returns: `0` or `fail` - > + >lua server:listen(128, function (err) local client = uv.new_tcp() server:accept(client) @@ -1382,7 +1382,7 @@ uv.read_start({stream}, {callback}) *uv.read_start()* Returns: `0` or `fail` - > + >lua stream:read_start(function (err, chunk) if err then -- handle read error @@ -1690,7 +1690,7 @@ uv.tcp_connect({tcp}, {host}, {port}, {callback}) *uv.tcp_connect()* Returns: `uv_connect_t userdata` or `fail` - > + >lua local client = uv.new_tcp() client:connect("127.0.0.1", 8080, function (err) -- check error and carry on. @@ -1755,7 +1755,7 @@ uv.socketpair([{socktype}, [{protocol}, [{flags1}, [{flags2}]]]]) Returns: `table` or `fail` - `[1, 2]` : `integer` (file descriptor) - > + >lua -- Simple read/write with tcp local fds = uv.socketpair(nil, nil, {nonblock=true}, {nonblock=true}) @@ -1780,7 +1780,7 @@ uv.socketpair([{socktype}, [{protocol}, [{flags1}, [{flags2}]]]]) Pipe handles provide an abstraction over local domain sockets on Unix and named pipes on Windows. - > + >lua local pipe = uv.new_pipe(false) pipe:bind('/tmp/sock.test') @@ -1959,7 +1959,7 @@ uv.pipe({read_flags}, {write_flags}) *uv.pipe()* - `read` : `integer` (file descriptor) - `write` : `integer` (file descriptor) - > + >lua -- Simple read/write with pipe_open local fds = uv.pipe({nonblock=true}, {nonblock=true}) @@ -1983,7 +1983,7 @@ uv.pipe({read_flags}, {write_flags}) *uv.pipe()* TTY handles represent a stream for the console. - > + >lua -- Simple echo program local stdin = uv.new_tty(0, true) local stdout = uv.new_tty(1, false) @@ -2537,7 +2537,7 @@ FS call. Synchronous and asynchronous versions of `readFile` (with naive error handling) are implemented below as an example: - > + >lua local function readFileSync(path) local fd = assert(uv.fs_open(path, "r", 438)) local stat = assert(uv.fs_fstat(fd)) @@ -2550,7 +2550,7 @@ handling) are implemented below as an example: print("synchronous read", data) < - > + >lua local function readFile(path, callback) uv.fs_open(path, "r", 438, function(err, fd) assert(not err, err) @@ -2626,7 +2626,7 @@ uv.fs_read({fd}, {size} [, {offset} [, {callback}]]) *uv.fs_read()* indicates EOF. If `offset` is nil or omitted, it will default to `-1`, which - indicates 'use and update the current file offset.' + indicates "use and update the current file offset." Note: When `offset` is >= 0, the current file offset will not be updated by the read. @@ -2665,7 +2665,7 @@ uv.fs_write({fd}, {data} [, {offset} [, {callback}]]) *uv.fs_write()* written. If `offset` is nil or omitted, it will default to `-1`, which - indicates 'use and update the current file offset.' + indicates "use and update the current file offset." Note: When `offset` is >= 0, the current file offset will not be updated by the write. @@ -3253,7 +3253,7 @@ Libuv provides a threadpool which can be used to run user code and get notified in the loop thread. This threadpool is internally used to run all file system operations, as well as `getaddrinfo` and `getnameinfo` requests. - > + >lua local function work_callback(a, b) return a + b end @@ -3355,7 +3355,7 @@ uv.getnameinfo({address} [, {callback}]) *uv.getnameinfo()* - `family`: `string` or `integer` or `nil` - `callback`: `callable` (async version) or `nil` (sync version) - - `err`: `nil` or `sring` + - `err`: `nil` or `string` - `host`: `string` or `nil` - `service`: `string` or `nil` |