From 82a223e4e0bf45827c20592aaa7d5690593802ff Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 2 Aug 2014 01:35:39 +0200 Subject: TOOLS: add test script for property change notifications --- TOOLS/lua/observe-all.lua | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 TOOLS/lua/observe-all.lua (limited to 'TOOLS') diff --git a/TOOLS/lua/observe-all.lua b/TOOLS/lua/observe-all.lua new file mode 100644 index 0000000000..68e09773c6 --- /dev/null +++ b/TOOLS/lua/observe-all.lua @@ -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 -- cgit v1.2.3