History

defaults.lua: fix some lint warnings

Kacper Michajłow committed 2 years ago

Commit fe488151 parent 5e77d3b1 file · +7 −6Browse files

Showing the changes to player/lua/defaults.lua (1 of 1 file). Show all

Unified · Split

player/lua/defaults.lua+7−6
@@ -1,5 +1,6 @@
11 -- 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
34
45 -- these are used internally by lua.c
56 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
9596 local cb_up = entry[4]
9697 if type(cb) ~= "string" then
9798 local mangle = reserve_binding()
98− dispatch_key_bindings[mangle] = function(name, state)
99+ dispatch_key_bindings[mangle] = function(_, state)
99100 local event = state:sub(1, 1)
100101 local is_mouse = state:sub(2, 2) == "m"
101102 local def = (is_mouse and "u") or "d"
@@ -156,7 +157,7 @@ function mp.flush_keybindings() · 54 unmodified lines
156157 flags = "force"
157158 end
158159 local bindings = {}
159− for k, v in pairs(key_bindings) do
160+ for _, v in pairs(key_bindings) do
160161 if v.bind and v.forced ~= def then
161162 bindings[#bindings + 1] = v
162163 end
@@ -199,7 +200,7 @@ local function add_binding(attrs, key, name, fn, rp) · 36 unmodified lines
199200 ["r"] = "repeat",
200201 ["p"] = "press",
201202 }
202− key_cb = function(name, state, key_name, key_text)
203+ key_cb = function(_, state, key_name, key_text)
203204 if key_text == "" then
204205 key_text = nil
205206 end
@@ -214,7 +215,7 @@ local function add_binding(attrs, key, name, fn, rp) · 8 unmodified lines
214215 fn({event = "press", is_mouse = false})
215216 end
216217 else
217− key_cb = function(name, state)
218+ key_cb = function(_, state)
218219 -- Emulate the same semantics as input.c uses for most bindings:
219220 -- For keyboard, "down" runs the command, "up" does nothing;
220221 -- for mouse, "down" does nothing, "up" runs the command.
@@ -428,7 +429,7 @@ end · 207 unmodified lines
428429 function mp.unregister_event(cb)
429430 for name, sub in pairs(event_handlers) do
430431 local found = false
431− for i, e in ipairs(sub) do
432+ for _, e in ipairs(sub) do
432433 if e == cb then
433434 found = true
434435 break

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t