Skip to content

Commit 51251d6

Browse files
committed
Update files after review
1 parent cb2837b commit 51251d6

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

doc/reference/reference_lua/box_events.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Below is a list of all functions and members related to watchers or events.
7171
* - :doc:`./box_events/broadcast`
7272
- Update a state.
7373

74-
* - :ref:`˜Built-in events <system-events>`
74+
* - :ref:`Built-in events <system-events>`
7575
- Predefined events in Tarantool
7676

7777
.. toctree::

doc/reference/reference_lua/box_events/system_events.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,28 +99,32 @@ Usage example
9999

100100
.. code-block:: lua
101101
102-
conn = net.box.connect(URI)
102+
local conn = net.box.connect(URI)
103103
-- Subscribe to updates of key 'box.id'
104-
w = conn:watch('box.id', function(key, value)
104+
local w = conn:watch('box.id', function(key, value)
105105
assert(key == 'box.id')
106106
-- do something with value
107107
end)
108-
-- or to updates of key 'box.status'
108+
-- or subscribe to updates of key 'box.status'
109109
w = conn:watch('box.status', function(key, value)
110110
assert(key == 'box.status')
111111
-- do something with value
112112
end)
113-
-- or to updates of key 'box.election'
113+
-- or subscribe to updates of key 'box.election'
114114
w = conn:watch('box.election', function(key, value)
115115
assert(key == 'box.election')
116116
-- do something with value
117117
end)
118-
-- or to updates of key 'box.schema'
118+
-- or subscribe to updates of key 'box.schema'
119119
w = conn:watch('box.schema', function(key, value)
120120
assert(key == 'box.schema')
121121
-- do something with value
122122
end)
123-
-- Unregister the watcher when it's no longer needed.
123+
124+
If you want to unregister the watcher when it's no longer needed, use the following command:
125+
126+
.. code-block:: lua
127+
124128
w:unregister()
125129
126130

doc/reference/reference_lua/box_events/watch.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ box.watch()
1313

1414
:return: a watcher handle. The handle consists of one method -- ``unregister()``, which unregisters the watcher.
1515

16-
To read more about watchers, see the `Functions for watchers <box-watchers>` section.
16+
To read more about watchers, see the :ref:`Functions for watchers <box-watchers>` section.
1717

1818
.. note::
1919

@@ -28,10 +28,14 @@ box.watch()
2828
-- Broadcast value 123 for the 'foo' key.
2929
box.broadcast('foo', 123)
3030
-- Subscribe to updates of the 'foo' key.
31-
w = box.watch('foo', function(key, value)
31+
local w = box.watch('foo', function(key, value)
3232
assert(key == 'foo')
3333
-- do something with value
3434
end)
35-
-- Unregister the watcher when it is no longer needed.
35+
36+
If you don't need the watcher anymore, you can unregister it using the command below:
37+
38+
.. code-block:: lua
39+
3640
w:unregister()
3741

doc/reference/reference_lua/net_box.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. _net_box-module:
1+
zc.. _net_box-module:
22

33
--------------------------------------------------------------------------------
44
Module net.box
@@ -545,7 +545,7 @@ Below is a list of all ``net.box`` functions.
545545
:param function func: a callback to invoke when the key value is updated
546546
:return: a watcher handle. The handle consists of one method -- ``unregister()``, which unregisters the watcher.
547547

548-
To read more about watchers, see the `Functions for watchers <box-watchers>` section.
548+
To read more about watchers, see the :ref:`Functions for watchers <box-watchers>` section.
549549

550550
The method has the same syntax as the :doc:`box.watch() </reference/reference_lua/box_events/broadcast>`
551551
function, which is used for subscribing to events locally.
@@ -583,7 +583,11 @@ Below is a list of all ``net.box`` functions.
583583
assert(key == 'foo')
584584
-- do something with value
585585
end)
586-
-- Unregister the watcher if it is no longer needed.
586+
587+
If you don't need the watcher anymore, you can unregister it using the command below:
588+
589+
.. code-block:: lua
590+
587591
w:unregister()
588592
589593
.. _conn-timeout:

0 commit comments

Comments
 (0)