Showing the changes to player/lua/defaults.lua (1 of 1 file). Show all
Unified · Split
| @@ -1,5 +1,6 @@ | |||
| 1 | -- Compatibility shim for lua 5.2/5.3 | 1 | -- Compatibility shim for lua 5.2/5.3 |
| 2 | unpack = unpack or table.unpack | 2 | -- luacheck: globals unpack |
| 3 | unpack = unpack or table.unpack -- luacheck: globals table.unpack | ||
| 3 | 4 | ||
| 4 | -- these are used internally by lua.c | 5 | -- these are used internally by lua.c |
| 5 | mp.UNKNOWN_TYPE.info = "this value is inserted if the C type is not supported" | 6 | mp.UNKNOWN_TYPE.info = "this value is inserted if the C type is not supported" |
| @@ -95,7 +96,7 @@ function mp.set_key_bindings(list, section, flags) · 89 unmodified lines | |||
| 95 | local cb_up = entry[4] | 96 | local cb_up = entry[4] |
| 96 | if type(cb) ~= "string" then | 97 | if type(cb) ~= "string" then |
| 97 | local mangle = reserve_binding() | 98 | local mangle = reserve_binding() |
| 98 | dispatch_key_bindings[mangle] = function(name, state) | 99 | dispatch_key_bindings[mangle] = function(_, state) |
| 99 | local event = state:sub(1, 1) | 100 | local event = state:sub(1, 1) |
| 100 | local is_mouse = state:sub(2, 2) == "m" | 101 | local is_mouse = state:sub(2, 2) == "m" |
| 101 | local def = (is_mouse and "u") or "d" | 102 | local def = (is_mouse and "u") or "d" |
| @@ -156,7 +157,7 @@ function mp.flush_keybindings() · 54 unmodified lines | |||
| 156 | flags = "force" | 157 | flags = "force" |
| 157 | end | 158 | end |
| 158 | local bindings = {} | 159 | local bindings = {} |
| 159 | for k, v in pairs(key_bindings) do | 160 | for _, v in pairs(key_bindings) do |
| 160 | if v.bind and v.forced ~= def then | 161 | if v.bind and v.forced ~= def then |
| 161 | bindings[#bindings + 1] = v | 162 | bindings[#bindings + 1] = v |
| 162 | end | 163 | end |
| @@ -199,7 +200,7 @@ local function add_binding(attrs, key, name, fn, rp) · 36 unmodified lines | |||
| 199 | ["r"] = "repeat", | 200 | ["r"] = "repeat", |
| 200 | ["p"] = "press", | 201 | ["p"] = "press", |
| 201 | } | 202 | } |
| 202 | key_cb = function(name, state, key_name, key_text) | 203 | key_cb = function(_, state, key_name, key_text) |
| 203 | if key_text == "" then | 204 | if key_text == "" then |
| 204 | key_text = nil | 205 | key_text = nil |
| 205 | end | 206 | end |
| @@ -214,7 +215,7 @@ local function add_binding(attrs, key, name, fn, rp) · 8 unmodified lines | |||
| 214 | fn({event = "press", is_mouse = false}) | 215 | fn({event = "press", is_mouse = false}) |
| 215 | end | 216 | end |
| 216 | else | 217 | else |
| 217 | key_cb = function(name, state) | 218 | key_cb = function(_, state) |
| 218 | -- Emulate the same semantics as input.c uses for most bindings: | 219 | -- Emulate the same semantics as input.c uses for most bindings: |
| 219 | -- For keyboard, "down" runs the command, "up" does nothing; | 220 | -- For keyboard, "down" runs the command, "up" does nothing; |
| 220 | -- for mouse, "down" does nothing, "up" runs the command. | 221 | -- for mouse, "down" does nothing, "up" runs the command. |
| @@ -428,7 +429,7 @@ end · 207 unmodified lines | |||
| 428 | function mp.unregister_event(cb) | 429 | function mp.unregister_event(cb) |
| 429 | for name, sub in pairs(event_handlers) do | 430 | for name, sub in pairs(event_handlers) do |
| 430 | local found = false | 431 | local found = false |
| 431 | for i, e in ipairs(sub) do | 432 | for _, e in ipairs(sub) do |
| 432 | if e == cb then | 433 | if e == cb then |
| 433 | found = true | 434 | found = true |
| 434 | break | 435 | break |