From 3df1e6454b06008628c5ef9cbe66c62cc6cccf47 Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 17 Aug 2018 10:46:49 -0400 Subject: [PATCH] add "getindex" command to read the stored message's scroll index position that is, the string index position of the first displayed character thereof. --- README.md | 1 + init.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/README.md b/README.md index afaae7e..6f0e6cd 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ The panels also respond to these control messages: * "scroll_step" will immediately advance the last-displayed message by one character. Omit the above automatic scrolling keywords, and use ONLY this keyword instead if you want to let your LuaController control the scrolling speed. * "get" will read the one character (as a numerical character value) currently displayed by the master panel (by reading its node name) * "getstr" will read the last-stored message for the entire lineup/wall (from the master panel's meta), respectively. Note that even if the message has been or is being scrolled, you'll get the original stored message. +* "getindex" will read the scroll index position in that message If you need vertical scrolling, you will have to handle that yourself (since the size of a screen/wall is not hard-coded). diff --git a/init.lua b/init.lua index fcc09b3..5c42e6a 100644 --- a/init.lua +++ b/init.lua @@ -205,6 +205,8 @@ local on_digiline_receive_string = function(pos, node, channel, msg) digiline:receptor_send(pos, digiline.rules.default, channel, tonumber(string.match(minetest.get_node(pos).name,"led_marquee:char_(.+)"))) -- wonderfully horrible string manipulaiton elseif msg == "getstr" then -- get the last stored message digiline:receptor_send(pos, digiline.rules.default, channel, meta:get_string("last_msg")) + elseif msg == "getindex" then -- get the last stored message + digiline:receptor_send(pos, digiline.rules.default, channel, meta:get_string("index")) else led_marquee.set_timer(pos, 0) meta:set_string("last_msg", msg)