From 126d420e3c264cef851b26e05109bac8dc790bed Mon Sep 17 00:00:00 2001 From: Rahix Date: Fri, 12 Apr 2019 10:50:26 +0200 Subject: [PATCH] Update README Signed-off-by: Rahix --- README.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 58fc3e2a59f1..ebee6ae0f386 100644 --- a/README.md +++ b/README.md @@ -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("") +bc = require("bc"):init(, ) ``` -where `` is the address of you networks master. -The master is only required to download the base structure file. +where `` is a table containing all nouns (described later) and their +initial value and `` 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("", value) -- Call a verb on it's network node bc:call_verb("", param) - --- Register a handler for verbs on the current machine -bc:on_verb("", function handler) ``` Additionally, there is @@ -37,8 +34,8 @@ Additionally, there is id = bc:listen_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("", 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 ```