Update README again
Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
parent
132cfb9921
commit
9f8e62923e
1 changed files with 24 additions and 6 deletions
30
README.md
30
README.md
|
|
@ -121,7 +121,7 @@ bc:set("some_noun", 4321)
|
|||
### `BaseControl:get(noun, [timeout])`
|
||||
Get the value of a noun named `noun`. `get` can not be called for verbs.
|
||||
If `timeout` is supplied, the call will return early if no response came before
|
||||
the timeout expired.
|
||||
the timeout expired. `get` will return `nil` if a name is not known.
|
||||
```lua
|
||||
local bc = require("bc"):finalize{"some_noun"}
|
||||
print("Value: ", bc:get("some_noun"))
|
||||
|
|
@ -166,7 +166,8 @@ If it is not known at this time, the listener is still installed in hope that
|
|||
the node will come online later. `query` must be a valid query, chosen from
|
||||
`BaseControl.Query`. A full list of currently supported queries was shown above.
|
||||
The `callback` function will get one argument: The new value of the noun that
|
||||
triggered the event.
|
||||
triggered the event. `listen` returns a unique id for the installed listener
|
||||
that could later be used to cancel it.
|
||||
|
||||
```lua
|
||||
bc = require("bc"):finalize{"some_noun"}
|
||||
|
|
@ -178,6 +179,21 @@ bc:listen("some_noun", bc.Query.Below(0), function(value)
|
|||
end)
|
||||
```
|
||||
|
||||
### `BaseControl:cancel(id)`
|
||||
Cancel a previously installed listener. The id will be invalid after this call.
|
||||
```lua
|
||||
local listenid = bc:listen("some_noun", bc.Query.Change, function(value)
|
||||
print("'some_noun' is now '"..value.."'")
|
||||
end)
|
||||
|
||||
-- Later ...
|
||||
bc:cancel(listenid)
|
||||
```
|
||||
|
||||
### `BaseControl:close()`
|
||||
End this base-controller and notify others of the local nouns and verbs going
|
||||
offline. Close will also cancel all installed listeners.
|
||||
|
||||
Introspection API
|
||||
-----------------
|
||||
The following methods give you insight into the network:
|
||||
|
|
@ -192,11 +208,13 @@ Whether `verb` is known at this time (either local or remote). Note that even i
|
|||
a verb is known, calling it might still not succeed if the remote node exited
|
||||
without deregistering. If you need to know for sure, call using `call_sync`.
|
||||
|
||||
### `BaseControl:nouns()`
|
||||
Returns a list of all known nouns (either local or remote).
|
||||
### `BaseControl:nouns([local_only])`
|
||||
Returns a list of all known nouns (either local or remote). If `local_only` is
|
||||
boolean true, only a list of local nouns will be returned.
|
||||
|
||||
### `BaseControl:verbs()`
|
||||
Returns a list of all known verbs (either local or remote).
|
||||
### `BaseControl:verbs([local_only])`
|
||||
Returns a list of all known verbs (either local or remote). If `local_only` is
|
||||
boolean true, only a list of local verbs will be returned.
|
||||
|
||||
Network Configuration
|
||||
---------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue