robbielyman / seamstress

seamstress is an art engine
GNU General Public License v3.0
123 stars 12 forks source link

fix: `params:add{}` #31

Closed andr-ew closed 1 year ago

andr-ew commented 1 year ago

previously, running params.add with table arguments, i.e.:

params:add{
    type = 'number', id = 'octave_'..chan, name = 'octave',
    min = -2, max = 2, default = 0,
    action = actions.rate_start_end
}

yielded this error:

 /usr/local/share/seamstress/lua/core/params.lua:79: attempt to index a nil value (local 'param')
stack traceback:
        /Users/and/sc-extensions/grvl-seamstress/script.lua:18: in main chunk
        [C]: in function 'require'
        /usr/local/share/seamstress/lua/core/seamstress.lua:49: in function '_startup'

because the add_<type> functions in this new take of params.lua don't return a param instance, but just call back into params:add with their instances. so I just added a return & let recursion do it's thing – this was the most unobtrusive fix, but maybe the back & forth feels a bit funky.

(cc @dndrks , I gather they wrote most/all of this bit !)