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
110-- TODO: Remove everything below this line110-- TODO: Remove everything below this line
111local todo = {111local todo = {
112 "player/lua/osc.lua",112 "player/lua/osc.lua",
113 "TOOLS/lua/command-test.lua",
114 "TOOLS/lua/cycle-deinterlace-pullup.lua",113 "TOOLS/lua/cycle-deinterlace-pullup.lua",
115 "TOOLS/lua/nan-test.lua",114 "TOOLS/lua/nan-test.lua",
116 "TOOLS/lua/observe-all.lua",115 "TOOLS/lua/observe-all.lua",
TOOLS/lua/command-test.lua+13−8
@@ -2,7 +2,7 @@ · 1 unmodified line
2 2
3local utils = require("mp.utils")3local utils = require("mp.utils")
4 4
5function join(sep, arr, count)5local function join(sep, arr, count)
6 local r = ""6 local r = ""
7 if count == nil then7 if count == nil then
8 count = #arr8 count = #arr
@@ -31,19 +31,19 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 22 unmodified lines
31 mp.set_property("screenshot-format", "png")31 mp.set_property("screenshot-format", "png")
32 mp.set_property("screenshot-png-compression", "9")32 mp.set_property("screenshot-png-compression", "9")
33 33
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)
35 timer:resume()35 timer:resume()
36 36
37 print("Slow screenshot command...")37 print("Slow screenshot command...")
38 res = mp.command_native({"screenshot"})38 local result = mp.command_native({"screenshot"})
39 print("done, res: " .. utils.to_string(res))39 print("done, res: " .. utils.to_string(result))
40 40
41 print("Slow screenshot async command...")41 print("Slow screenshot async command...")
42 res = mp.command_native_async({"screenshot"}, function(res)42 result = mp.command_native_async({"screenshot"}, function(res)
43 print("done (async), res: " .. utils.to_string(res))43 print("done (async), res: " .. utils.to_string(res))
44 timer:kill()44 timer:kill()
45 end)45 end)
46 print("done (sending), res: " .. utils.to_string(res))46 print("done (sending), res: " .. utils.to_string(result))
47 47
48 print("Broken screenshot async command...")48 print("Broken screenshot async command...")
49 mp.command_native_async({"screenshot-to-file", "/nonexistent/bogus.png"},49 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
51 print("done err scr.: " .. join(" ", {res, val, err}))51 print("done err scr.: " .. join(" ", {res, val, err}))
52 end)52 end)
53 53
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 },
55 function(res, val, err)59 function(res, val, err)
56 print("done subprocess: " .. join(" ", {res, val, err}))60 print("done subprocess: " .. join(" ", {res, val, err}))
57 end)61 end)
@@ -105,7 +109,8 @@ mp.observe_property("vo-configured", "bool", function(_, v) · 47 unmodified lines
105 playback_only = false, args = {"sleep", "inf"}})109 playback_only = false, args = {"sleep", "inf"}})
106end)110end)
107 111
108function freeze_test(playback_only)112local counter
113local function freeze_test(playback_only)
109 -- This "freezes" the script, should be killed via timeout.114 -- This "freezes" the script, should be killed via timeout.
110 counter = counter and counter + 1 or 0115 counter = counter and counter + 1 or 0
111 print("freeze! " .. counter)116 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