-- Mode-switch input handling: turns V/N/H/R/Escape presses into writes of -- the editor.mode property. Separate from editor_ui.lua, which only reacts -- to that property and doesn't care what triggers it. local key_to_mode = { [KEY_V] = "Vertex", [KEY_N] = "Neighbor", [KEY_H] = "Hex", [KEY_R] = "Region", [KEY_ESCAPE] = "None", } app.subscribe("engine.key", function(source, key, action, mods) if action ~= PRESS then return end local mode = key_to_mode[key] if mode then app.set("editor.mode", mode) end end)