Skip to content

Fix keybindings menu Lua mock spinning on Lua 5.4+ ipairs - #11095

Open
yzzztech wants to merge 1 commit into
omacom:quattrofrom
yzzztech:fix-keybindings-lua-mock-ipairs
Open

Fix keybindings menu Lua mock spinning on Lua 5.4+ ipairs#11095
yzzztech wants to merge 1 commit into
omacom:quattrofrom
yzzztech:fix-keybindings-lua-mock-ipairs

Conversation

@yzzztech

Copy link
Copy Markdown

Fixes #11094

The keybindings menu's Lua bind scan hangs at 100% CPU when a config iterates a mock value with ipairs/pairs. Lua 5.4 changed ipairs to consult __index; the mock's noop answered every integer key with itself, so ipairs(noop) looped forever (e.g. iterating hl.get_active_window().tags).

The fix makes __index return nil for numeric keys so iteration terminates, while named keys still return noop so chaining (window.tags, :set_enabled(), hl.dsp.*) keeps working.

Adds a regression test that walks hl.get_active_window().tags at config load — it hangs without the fix and passes with it.

Lua 5.4+ makes ipairs consult __index. The mock's noop answered every
integer key with itself, so iterating a mock value (e.g.
hl.get_active_window().tags) looped forever and pegged a core. Return nil
for numeric keys so ipairs/pairs terminate, while named keys still chain.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keybindings menu (Super+K) spins at 100% CPU: Lua mock incompatible with Lua 5.4+ ipairs

1 participant