@jah & @tehn: Thanks for your answers, these gave me quite something to chew on.
There are 2 tables (with integer numbers), and 4 integer numbers, the totality of which I want to store and recall as a preset (while the AWAKE sequence is running, without messing with the timing).
I understand that such a preset can be accomplished with nested tables inside the script, but when I send norns to sleep, everything will be gone, so I must find a way to write the contents of all presets I might create at runtime to disk to retrieve them later (e.g. after awakening norns).
Thanks, but I have to admit this is way over my head (I am not only new to Lua, but new programming at all). To name just 2 questions I had after reading it:
- where do I specify the name for the text file that is generated?
- how do I load the values stored in the text file? The text just said “In order to restore this value, a lua_dofile suffices.”, which left me rather puzzled.
Thanks much, while I am far from really understanding it, this looks way more explicit and thus comprehensible to me than the section from the Lua manual! I will try to work my way thru this during the next days, for now I will try to create the (volatile) preset management in AWAKE first.
Just 2 questions for now:
- The code for the new PLAYFAIR ends with
cleanup = function()
playfair_save()
end
What does this mean? cleanup is not used anywhere else in the script, so when&how do these lines get executed?
- What is the purpose of these
require commands, and why are they sometimes put into variables?
require 'er'
engine.name = 'Ack'
local ack = require 'jah/ack'
local BeatClock = require 'beatclock'
Thanks much in advance!