Norns Save Table to Param?

Is it possible to save an arbitrary Lua table to a param? I realise there would likely be no way to set the values for the data inside the table via the Params menu, but it would still be nice to be able to save and recall data about, say, a custom note scale set via a UI to a param.

1 Like

it’s not using the param system, but check out tabutil it has a table saving and loading method :cowboy_hat_face:

https://monome.org/docs/norns/api/modules/tabutil.html#save

3 Likes

love these q’s + a’s!

to perform a tabutil save or load with a PSET save or load, you can also assign functions to params.action_write and params.action_read, which will be called when a PSET is written or read. it was added by Zack a few months ago, but didn’t make it into the docs – i’ve made a note to add it in today!

7 Likes

20 characters of “Cool, thanks guys!”

just closing the loop that i added a barebones example a week ago, but dropped in a more robust example today: params | monome/docs

(always nice when ~60 lines of docs code generates its own background music while finishing the doc)

4 Likes

Timing of this question couldn’t be better! I’m building a sequencer with some class-like tables and this saved me from a ton of refactoring to move everything into a parameter.

followup question—is there a way to hook into a PSET being deleted? It occurred to me that the data files will just hangout there indefinitely unless manually removed. Is that correct?

oh good call, i’ve proposed adding a delete callback as well as PSET numbers to help with data management – i realized that in the example, if an artist chose the same name for many PSETs, then they would overwrite each other. hang tight for revision!

3 Likes

closing the loop!
the PR linked above was approved + will be merged into the next norns update. EDIT: i had previously thought this made the cutoff for the latest 220321 update, but it didn’t, apologies for the false lead!

i pulled the docs update as well, so as not to further confuse, but here’s how i adapted my code to take advantage of the pset-last.txt file to drive naming: less-concepts/less-concepts.lua at 42a61422e11ba79e72317c82c66163023d506311 · vicimity-dndrks/less-concepts · GitHub

while there’s no delete functionality as of now, i figure if we’re sticking to building additional files inside of matching-named folders, then there shouldn’t be too much cruff. apologies for jumping the gun!

3 Likes