instead of string.char(0-27), use "/" as an escape followed by
"[0-9][A-R][a-r]", all inside the string.
e.g. digiline_send("chan", "/0this /1is /2some /3colorful /4text")
"/" followed by any other character than the above will be treated as an
invalid color code and will be taken literally.
"//" will print a single slash.
Note: on receipt, all instances of "//" in a message are actually
translated to string.char(30) -- one for each pair. This makes the
scrolling code easier. Keep this in mind if you use the "getstr" and
"getindex" commands.
Also, this expands the max string length to 6 kB, to allow a full 80x25
display with one color code er character. "clear" and "allon" remain at
2kB since that's still enough.
also make sure to `return false` from the scroll_text function if the
scroll timer was last set to a value below the allowed minimum (which
would mean the user/program intended to shut it off by setting it to 0,
or the stepper was called manually, implying no timer)
translate them to bare ISO-8859-1 at print time
Only alters chars with codes > 0x9f, so graphics/symbols in the
0x7f-0x9f range and color and control codes < 0x20 are preserved
The routine assumes that any char code > 0x9f is the first byte of a
two-byte UTF-8 symbol.
Note that due to Minetest's busted formspecs, it's not possible to
actually type-in or copy-paste proper UTF strings to take advantage of
this mode, so it's only useful if the strings are generated by or
imported in from something else (e.g. a URL or something, or a LuaC
program that generates strings)
Stack up a wall of LED panels, any horizontal and vertical amount
Set a channel on the upper left panel, leave the others un-set, and
connect a LuaC to it via digilines.
Long strings sent to that channel will be displayed using all panels,
starting at the upper-left and working from left to right, top to
bottom, wrapping from line to line as appropriate (similar to printing
to a shell terminal).
string.char(28) can be inserted anywhere to force a linefeed.
As usual, printing continues from node to node until the program either
finds a panel with a different non-empty channel than the first one, or
it finds a panel that's facing the wrong way.
If the program finds something other than a panel, it wraps to the next
line. If it finds something other than a panel twice in a row, that
signals that text has wrapped off of the last row, and printing is cut
off.
Lines of panels don't need to be the same length, the program will wrap
as needed.
This commit also gets rid of the end-of-line padding, uses proper
string.rep() to create the all-off and all-on fills (each of which is
1kB), and fixes one or two other minor issues.
Strings are trimmed to 1 kB.
Panels are not erased between prints.