History

TOOLS/command-test.lua: fix lint warnings

Guido Cella committed 2 years ago

Commit f3f77351 parent 843161d2 files · +13 −9Browse files

Unified · Split

2 files
  1. .luacheckrc +0 −1
  2. TOOLS/lua/command-test.lua +13 −8
.luacheckrc+0−1
@@ -110,7 +110,6 @@ max_line_length = 100 · 109 unmodified lines
110110 -- TODO: Remove everything below this line
111111 local todo = {
112112 "player/lua/osc.lua",
113− "TOOLS/lua/command-test.lua",
114113 "TOOLS/lua/cycle-deinterlace-pullup.lua",
115114 "TOOLS/lua/nan-test.lua",
116115 "TOOLS/lua/observe-all.lua",
TOOLS/lua/command-test.lua+13−8
@@ -2,7 +2,7 @@ · 1 unmodified line
22
33 local utils = require("mp.utils")
44
5−function join(sep, arr, count)
5+local function join(sep, arr, count)
66 local r = ""
77 if count == nil then
88 count = #arr
@@ -31,19 +31,19 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 22 unmodified lines
3131 mp.set_property("screenshot-format", "png")
3232 mp.set_property("screenshot-png-compression", "9")
3333
34− timer = mp.add_periodic_timer(0.1, function() print("I'm alive") end)
34+ local timer = mp.add_periodic_timer(0.1, function() print("I'm alive") end)
3535 timer:resume()
3636
3737 print("Slow screenshot command...")
38− res = mp.command_native({"screenshot"})
39− print("done, res: " .. utils.to_string(res))
38+ local result = mp.command_native({"screenshot"})
39+ print("done, res: " .. utils.to_string(result))
4040
4141 print("Slow screenshot async command...")
42− res = mp.command_native_async({"screenshot"}, function(res)
42+ result = mp.command_native_async({"screenshot"}, function(res)
4343 print("done (async), res: " .. utils.to_string(res))
4444 timer:kill()
4545 end)
46− print("done (sending), res: " .. utils.to_string(res))
46+ print("done (sending), res: " .. utils.to_string(result))
4747
4848 print("Broken screenshot async command...")
4949 mp.command_native_async({"screenshot-to-file", "/nonexistent/bogus.png"},
@@ -51,7 +51,11 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 1 unmodified line
5151 print("done err scr.: " .. join(" ", {res, val, err}))
5252 end)
5353
54− mp.command_native_async({name = "subprocess", args = {"sh", "-c", "echo hi && sleep 10s"}, capture_stdout = true},
54+ mp.command_native_async({
55+ name = "subprocess",
56+ args = {"sh", "-c", "echo hi && sleep 10s"},
57+ capture_stdout = true
58+ },
5559 function(res, val, err)
5660 print("done subprocess: " .. join(" ", {res, val, err}))
5761 end)
@@ -105,7 +109,8 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 47 unmodified lines
105109 playback_only = false, args = {"sleep", "inf"}})
106110 end)
107111
108−function freeze_test(playback_only)
112+local counter
113+local function freeze_test(playback_only)
109114 -- This "freezes" the script, should be killed via timeout.
110115 counter = counter and counter + 1 or 0
111116 print("freeze! " .. counter)

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