summaryrefslogtreecommitdiff
path: root/mesecons_luacontroller/help
diff options
context:
space:
mode:
authorcheapie <no-email-for-you@example.com>2022-01-02 18:42:08 -0600
committercheapie <no-email-for-you@example.com>2022-01-02 18:42:08 -0600
commit243a8063ddbb107ab191aa333cc6cdc85701f410 (patch)
tree848d72cd8b91cc9d259f75196bfd577bd8e88e66 /mesecons_luacontroller/help
parent648f77bd43f1fbe59e6d655e57d96e2647a43b68 (diff)
downloadmesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar.gz
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar.bz2
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.tar.xz
mesecons-243a8063ddbb107ab191aa333cc6cdc85701f410.zip
Add Luacontroller examples/help system
Diffstat (limited to 'mesecons_luacontroller/help')
-rw-r--r--mesecons_luacontroller/help/digilines.txt18
-rw-r--r--mesecons_luacontroller/help/events.txt12
-rw-r--r--mesecons_luacontroller/help/interrupts.txt22
-rw-r--r--mesecons_luacontroller/help/introduction.txt8
-rw-r--r--mesecons_luacontroller/help/luafunctions.txt60
-rw-r--r--mesecons_luacontroller/help/mesecons.txt24
-rw-r--r--mesecons_luacontroller/help/terminal.txt18
7 files changed, 162 insertions, 0 deletions
diff --git a/mesecons_luacontroller/help/digilines.txt b/mesecons_luacontroller/help/digilines.txt
new file mode 100644
index 0000000..85d1076
--- /dev/null
+++ b/mesecons_luacontroller/help/digilines.txt
@@ -0,0 +1,18 @@
+Digilines
+=========
+
+If the digilines mod is installed, then Luacontrollers can also send/receive digilines signals.
+
+To send a digilines signal, use the digiline_send() function.
+Example:
+digiline_send("lcd","Hello") --Sends the message "Hello" on the channel "lcd"
+
+Please note that digilines messages are sent from all pins, and there is no need or ability to select one.
+
+When a digilines signal is received, an event occurs.
+Example:
+{
+ type = "digiline",
+ channel = "lcd",
+ msg = "Hello"
+}
diff --git a/mesecons_luacontroller/help/events.txt b/mesecons_luacontroller/help/events.txt
new file mode 100644
index 0000000..cd2bcef
--- /dev/null
+++ b/mesecons_luacontroller/help/events.txt
@@ -0,0 +1,12 @@
+Events
+======
+
+Unlike some other types of programs, Luacontroller programs cannot run continously.
+Instead, they run whenever something (an event) happens, and an "event" table is made available with details.
+
+Event types include:
+* 'program' - Program was loaded
+* 'on' and 'off' - A Mesecons pin changed on/off state
+* 'digiline' (if Digilines is installed) - A Digilines message was received
+* 'interrupt' - An interrupt timer reached zero
+* 'terminal' - Text was typed into the terminal
diff --git a/mesecons_luacontroller/help/interrupts.txt b/mesecons_luacontroller/help/interrupts.txt
new file mode 100644
index 0000000..3c5e54f
--- /dev/null
+++ b/mesecons_luacontroller/help/interrupts.txt
@@ -0,0 +1,22 @@
+Interrupts
+==========
+
+Interrupts allow you to schedule an event to occur later. You can also specify an interrupt ID (IID) for use in keeping track of multiple pending interrupts at the same time.
+
+To schedule an interrupt, use the interrupt() function.
+Example:
+interrupt(5,"test") --In 5 seconds, an interrupt will occur with the IID "test"
+
+Setting a third parameter to true will cause the interrupt to be "lightweight", where timing stops if the mapblock containing the Luacontroller is unloaded, and automatically resumes when it is loaded again. This stops machines from continously running when no players are in the area.
+Example:
+interrupt(5,"test",true) --Same as above, but lightweight
+
+Lightweight mode does have a few differences - timing resolution is limited to one second, however pending interrupts can also be canceled by specifying a nil time and the same IID as previously.
+Some servers may force all interrupts to be lightweight.
+
+When an interrupt's time expires, an event occurs.
+Example:
+{
+ type = "interrupt",
+ iid = "test"
+}
diff --git a/mesecons_luacontroller/help/introduction.txt b/mesecons_luacontroller/help/introduction.txt
new file mode 100644
index 0000000..253ddd4
--- /dev/null
+++ b/mesecons_luacontroller/help/introduction.txt
@@ -0,0 +1,8 @@
+Luacontroller Introduction
+==========================
+
+Welcome! This device is a Luacontroller (or "LuaC" for short), which is an advanced microcontroller capable of interacting with many devices and performing complex processing.
+
+As the name suggests, the Lua programming language is used to program this device.
+If you aren't familiar with Lua, a tutorial/reference can be found here:
+http://lua-users.org/wiki/TutorialDirectory
diff --git a/mesecons_luacontroller/help/luafunctions.txt b/mesecons_luacontroller/help/luafunctions.txt
new file mode 100644
index 0000000..8c39529
--- /dev/null
+++ b/mesecons_luacontroller/help/luafunctions.txt
@@ -0,0 +1,60 @@
+Lua Functions
+=============
+
+The following Lua functions are available in a Luacontroller:
+
+From the string library:
+* byte
+* char
+* format
+* len
+* lower
+* upper
+* rep (restricted)
+* reverse
+* sub
+* find (restricted)
+
+From the math library:
+* abs
+* acos
+* asin
+* atan
+* atan2
+* ceil
+* cos
+* cosh
+* deg
+* exp
+* floor
+* fmod
+* frexp
+* ldexp
+* log
+* log10
+* max
+* min
+* modf
+* pow
+* rad
+* random
+* sin
+* sinh
+* sqrt
+* tan
+* tanh
+
+From the table library:
+* concat
+* insert
+* maxn
+* remove
+* sort
+
+From the os library:
+* clock
+* difftime
+* time
+
+Other:
+* print
diff --git a/mesecons_luacontroller/help/mesecons.txt b/mesecons_luacontroller/help/mesecons.txt
new file mode 100644
index 0000000..8b8d562
--- /dev/null
+++ b/mesecons_luacontroller/help/mesecons.txt
@@ -0,0 +1,24 @@
+Mesecons I/O
+============
+
+Luacontrollers provide four pins for mesecons connections, labeled from A to D.
+There is no need to manually switch between input and output modes - any pin not outputting mesecons power automatically works as an input.
+
+Input states can be read from the pin table.
+Example:
+if pin.a then
+ --Code here would be run only if pin A is active
+end
+
+Outputs can be set by writing to the port table.
+Example:
+port.b = true --Outputs a signal on pin B
+
+When a pin starts or stops receiving a signal, an event occurs with some information about the pin.
+Example:
+{
+ type = "on",
+ pin = {
+ name = "A"
+ }
+}
diff --git a/mesecons_luacontroller/help/terminal.txt b/mesecons_luacontroller/help/terminal.txt
new file mode 100644
index 0000000..9b23eed
--- /dev/null
+++ b/mesecons_luacontroller/help/terminal.txt
@@ -0,0 +1,18 @@
+Terminal I/O
+============
+
+Simple text I/O is available on the "terminal" tab.
+
+To send text to the Luacontroller, enter the message into the field provided, then press enter or click the send button.
+An event will occur containing the text entered.
+Example:
+{
+ type = "terminal",
+ text = "apt moo"
+}
+
+To display a message on the terminal, use the print() function.
+Example:
+print("Have you mooed today?")
+
+Errors and warnings are also displayed on the terminal.