This might make certain use cases less of a mess.
Showing the changes to player/lua/defaults.lua (1 of 2 files). Show all
Unified · Split
| @@ -54,10 +54,10 @@ local function reserve_binding() · 53 unmodified lines | ||
| 54 | 54 | return "__keybinding" .. tostring(message_id) |
| 55 | 55 | end |
| 56 | 56 | |
| 57 | −local function dispatch_key_binding(name, state) | |
| 57 | +local function dispatch_key_binding(name, state, key_name) | |
| 58 | 58 | local fn = dispatch_key_bindings[name] |
| 59 | 59 | if fn then |
| 60 | − fn(name, state) | |
| 60 | + fn(name, state, key_name) | |
| 61 | 61 | end |
| 62 | 62 | end |
| 63 | 63 | |
| @@ -176,10 +176,11 @@ local function add_binding(attrs, key, name, fn, rp) · 112 unmodified lines | ||
| 176 | 176 | ["r"] = "repeat", |
| 177 | 177 | ["p"] = "press", |
| 178 | 178 | } |
| 179 | − key_cb = function(name, state) | |
| 179 | + key_cb = function(name, state, key_name) | |
| 180 | 180 | fn({ |
| 181 | 181 | event = key_states[state:sub(1, 1)] or "unknown", |
| 182 | − is_mouse = state:sub(2, 2) == "m" | |
| 182 | + is_mouse = state:sub(2, 2) == "m", | |
| 183 | + key = key_name, | |
| 183 | 184 | }) |
| 184 | 185 | end |
| 185 | 186 | msg_cb = function() |