While the Norns: scripting thread is about how to write scripts and work with the norns environment, this thread is intended to be a place to request review of working code. How can we make our scripts more readable / shareable / extensible.
I encourage you to post links to code, preferably using gist.github.com. Reviewers can then place their thoughts in the comments of the gist, and this thread can be a repository of links with a short blurb explaining the nature of the review.
//
Let me start:
I was reading through the SPACETIME study and had some thoughts about how to make the actions more easily extensible (and less error-prone). My solution was a table of tables (called COMMANDS) which wraps the labels & functions inside. Iām using the #
operator in Lua which perhaps was beyond the scope of that tutorial.
The functions could be anonymous (ie. remove the āincā, ādecā, ābottomā etc) but I opted to keep them as some self-documentation.
Iād be interested to hear if this feels more or less readable. The big benefit is that in order to add a new COMMAND, only a single line of code needs to be added.