Grindling/patternsidea.lua
2020-05-21 22:11:07 -07:00

25 lines
673 B
Lua

-- PATTERN: table of patterns to be sent on initialization and/or
-- after "program" channel receives a pattern table
-- Patterns individually sent on "setsort"
-- Completion message sent on "status"
function send()
if mem.send > 0 then
digiline_send("setsort", PATTERN[mem.send])
mem.send = mem.send - 1
interrupt(1.2)
elseif mem.send == 0 then
digiline_send("status", "Programming complete.")
else
mem.send = #PATTERN
interrupt(1.2)
end
end
if (event.type == "program" and PATTERN) or event.type == "interrupt" then
send()
elseif event.type == "digiline" and event.channel == "program" then
PATTERN = event.msg
send()
end