mirror of
https://github.com/mpv-player/mpv
synced 2025-03-02 20:28:02 +00:00
TOOLS: add test script for property change notifications
This commit is contained in:
parent
be337aa415
commit
82a223e4e0
16
TOOLS/lua/observe-all.lua
Normal file
16
TOOLS/lua/observe-all.lua
Normal file
@ -0,0 +1,16 @@
|
||||
-- Test script for property change notification mechanism.
|
||||
|
||||
function format_property_val(v)
|
||||
if type(v) == "table" then
|
||||
return mp.format_table(v) -- undocumented function; might be removed
|
||||
else
|
||||
return tostring(v)
|
||||
end
|
||||
end
|
||||
|
||||
for i,name in ipairs(mp.get_property_native("property-list")) do
|
||||
mp.observe_property(name, "native", function(name, val)
|
||||
print("property '" .. name .. "' changed to '" ..
|
||||
format_property_val(val) .. "'")
|
||||
end)
|
||||
end
|
Loading…
Reference in New Issue
Block a user