gwatcha / reaper-keys

vim-bindings for Reaper
https://gwatcha.github.io/reaper-keys/
MIT License
141 stars 10 forks source link

attempt to index a nil value (local 'all_data') #52

Closed Le-Brut closed 3 years ago

Le-Brut commented 3 years ago

Hi! Quite a nice package. But I encountered a problem. At first, after I have installed reaper-keys, they worked just fine. Then, I have changed some bindings (right in the definitions directory, and not in bindings.lua as advised). The changes worked fine until I closed reaper, opened it again and now every command results in an error like this:

Reaper-Keys[ERROR]: ...ER\Scripts\.\reaper-keys\internal\utils\reaper_state.lua:38: attempt to index a nil value (local 'all_data')
Reaper-Keys[ERROR]: stack traceback:
    ...ng\REAPER\Scripts\.\reaper-keys\internal\reaper-keys.lua:26: in function 'errorHandler'
    ...ER\Scripts\.\reaper-keys\internal\utils\reaper_state.lua:38: in function 'utils.reaper_state.append'
    ...EAPER\Scripts\.\reaper-keys\internal\command\handler.lua:40: in function 'handleCommand'
    ...s\.\reaper-keys\internal\state_machine\state_machine.lua:42: in function 'step'
    ...s\.\reaper-keys\internal\state_machine\state_machine.lua:67: in function 'state_machine'
    [C]: in function 'xpcall'
    ...ng\REAPER\Scripts\.\reaper-keys\internal\reaper-keys.lua:30: in function 'doInput'
    ...ming\REAPER\Scripts\.\reaper-keys\key_scripts\main_b.lua:8: in main chunk

One important thing to note is: the bindings still work. But the error message just keeps showing up for every binding. I have tried removing reaper-kb.ini. I have even removed reaper-keys and set it up again. The errors won't go away. OS: Windows 7. Reaper 6.29. I am using the master version or reaper-keys. Any clue what this could be?

gwatcha commented 3 years ago

Hey sorry for the long response time! Try deleting the reaper-keys/internal/state_machine/state.lua file.

Le-Brut commented 3 years ago

There was no state.lua in that directory, only constants.lua, state_machine.lua and state_interface.lua. I tried removing the latter two, and got the following errors:

no file 'C:\Program Files\REAPER (x64)\lua\state_machine.lua'
    no file 'C:\Program Files\REAPER (x64)\lua\state_machine\init.lua'
    no file 'C:\Program Files\REAPER (x64)\state_machine.lua'
    no file 'C:\Program Files\REAPER (x64)\state_machine\init.lua'
    no file 'C:\Program Files\REAPER (x64)\..\share\lua\5.3\state_machine.lua'
    no file 'C:\Program Files\REAPER (x64)\..\share\lua\5.3\state_machine\init.lua'
    no file '.\state_machine.lua'
    no file '.\state_machine\init.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\state_machine.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\internal\state_machine.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\internal\..\definitions\state_machine.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\internal\state_machine\state_machine.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\internal\vendor\share\lua\5.3\state_machine.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\internal\vendor\share\lua\5.3\state_machine\init.lua'
    no file 'C:\Users\siemens\AppData\Roaming\REAPER\Scripts\.\reaper-keys\internal\vendor\scythe\state_machine.lua'
    no file 'C:\Program Files\REAPER (x64)\state_machine.dll'
    no file 'C:\Program Files\REAPER (x64)\..\lib\lua\5.3\state_machine.dll'
    no file 'C:\Program Files\REAPER (x64)\loadall.dll'
    no file '.\state_machine.dll'

In fact, I have tried removing reaper-keys and git cloning it again, but that didn't help, so I guess there's some other change that happened...

gwatcha commented 3 years ago

The other files are needed so these errors make sense, I'm still trying to figure out the initial error. It seems it has to do with a buggy entry being put into Reapers state system, so that would explain why it stayed after reinstalling. I'm working on a solution now.

gwatcha commented 3 years ago

Could you try the latest master?

Le-Brut commented 3 years ago

@gwatcha Great, no errors so far! Thanks for the fix!