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 @@
1-- Compatibility shim for lua 5.2/5.31-- Compatibility shim for lua 5.2/5.3
2unpack = unpack or table.unpack2-- luacheck: globals unpack
3unpack = unpack or table.unpack -- luacheck: globals table.unpack
3 4
4-- these are used internally by lua.c5-- these are used internally by lua.c
5mp.UNKNOWN_TYPE.info = "this value is inserted if the C type is not supported"6mp.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" then97 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 end158 end
158 local bindings = {}159 local bindings = {}
159 for k, v in pairs(key_bindings) do160 for _, v in pairs(key_bindings) do
160 if v.bind and v.forced ~= def then161 if v.bind and v.forced ~= def then
161 bindings[#bindings + 1] = v162 bindings[#bindings + 1] = v
162 end163 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 == "" then204 if key_text == "" then
204 key_text = nil205 key_text = nil
205 end206 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 end216 end
216 else217 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
428function mp.unregister_event(cb)429function mp.unregister_event(cb)
429 for name, sub in pairs(event_handlers) do430 for name, sub in pairs(event_handlers) do
430 local found = false431 local found = false
431 for i, e in ipairs(sub) do432 for _, e in ipairs(sub) do
432 if e == cb then433 if e == cb then
433 found = true434 found = true
434 break435 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