Commit Graph

16 Commits

Author SHA1 Message Date
Guido Cella 525fa85932 osc.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c5468ba5ff TOOLS/test-hooks.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 3613070380 TOOLS/status-line.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c28525ac9d TOOLS/osd-test.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 1f356d6784 TOOLS/observe-all.lua: fix lint warning 2024-06-02 22:26:00 +02:00
Guido Cella 5977722adc TOOLS/nan-test.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella c12e437d43 TOOLS/cycle-deinterlace-pullup.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella f3f77353f2 TOOLS/command-test.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 843161d96e TOOLS/autoload.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 44d7100296 TOOLS/autodeint.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 142b75a95f TOOLS/autocrop.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella ee514c6acf TOOLS/ao-null-reload.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella 62868beffe ytdl_hook.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella fe760f2b8a console.lua: fix lint warnings 2024-06-02 22:26:00 +02:00
Guido Cella eb4c6be630 console.lua: don't convert integers for mp.input to string
I misunderstood CogentRedTester's review in
https://github.com/mpv-player/mpv/pull/10282#discussion_r1428972352 as
referring to the cursor_position in mp.input's arguments instead of the
one received by the closed callback.

The cursor_position passed to input.get doesn't need to be converted to
a number because it was already JSON, while the cursor_position received
by the closed callback is currently a string, and we need to pass JSON
in input-event script messages to keep it as an integer to work around
mpv converting integer script message arguments to string.

This is more noticeable after implementing mp.input.select(): its submit
argument currently receives the selected index as a string, and this
makes Lua error if you use it as an index of a numerical table, e.g.:

submit = function (id)
    mp.set_property(property, tracks[tonumber(id)].selected and "no"
                              or tracks[tonumber(id)].id)
    ...
end,

This commit avoids having to call tonumber(id).
2024-05-12 23:13:48 +02:00
Kacper Michajłow 0084fbd458 github/workflows: add lua linting 2024-05-12 20:06:39 +02:00