Update README

Signed-off-by: Rahix <rahix@rahix.de>
dev
rahix 7 years ago
parent 3c4920489a
commit 126d420e3c

@ -1,21 +1,21 @@
oc-basecontrol
==============
oc-basecontrol is a OpenComputers generic base control library.
oc-basecontrol is an OpenComputers generic base control library.
## Documentation ##
Load oc-basecontrol into your application:
```lua
bc = require("bc"):init("<master-address>")
bc = require("bc"):init(<nouns>, <verbs>)
```
where `<master-address>` is the address of you networks master.
The master is only required to download the base structure file.
where `<nouns>` is a table containing all nouns (described later) and their
initial value and `<verbs>` is a table containing all verbs and their callbacks.
The basic idea behind basecontrol is, that network node have a set of **nouns**,
The basic idea behind basecontrol is, that network nodes have a set of **nouns**,
which represent different values. A computer near a reactor for example could have
a noun called `power-output`. Network nodes also have **verbs**, actions that other
nodes can perform. The reactor comuputer could have a `shutdown` verb for example.
nodes can perform. The reactor computer could have a `shutdown` verb for example.
The `bc` object has the following methods to interface with verbs and nouns:
```lua
@ -27,9 +27,6 @@ bc:set_noun("<noun>", value)
-- Call a verb on it's network node
bc:call_verb("<verb>", param)
-- Register a handler for verbs on the current machine
bc:on_verb("<verb>", function handler)
```
Additionally, there is
@ -37,8 +34,8 @@ Additionally, there is
id = bc:listen_noun("<noun>", event_type, event_arg, function callback)
```
which is used to register asynchroneous callbacks on noun changes.
`event_type` is one of
which is used to register asynchroneous callbacks on (possibly remote) noun
changes. `event_type` is one of
* `onchange` => whenever the value changes, `event_arg` is ignored
* `onrising` => whenever the value gets bigger, `event_arg` is ignored
@ -54,7 +51,7 @@ bc:listen_cancel("<noun>", id)
```
## Testing ##
Testing is done using the "fake" backend and typing
Testing is done using a "fake" backend and typing
```console
$ ./lunit test_bc.lua
```

Loading…
Cancel
Save