monome / norns

norns is many sound instruments.
http://monome.org
GNU General Public License v3.0
633 stars 147 forks source link

fix undefined `gamepad` when `script.clear` gets called #1621

Closed p3r7 closed 1 year ago

p3r7 commented 1 year ago

i discovered that https://github.com/monome/norns/pull/1439 introduced this error when script.clear gets called.

/home/we/norns/lua/core/script.lua:90: attempt to call a nil value (field 'clear')
stack traceback:
    /home/we/norns/lua/core/script.lua:90: in function 'core/script.clear'
    /home/we/norns/lua/core/script.lua:166: in function 'core/script.load'
    (...tail calls...)

corresponding line:

keyboard.clear()
gamepad.clear()             -- <- culprit

the problem was that unlike keyboard, gamepad was not loaded in the global context.