summaryrefslogtreecommitdiffstats
path: root/TOOLS/lua
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-02 01:35:39 +0200
committerwm4 <wm4@nowhere>2014-08-02 01:53:21 +0200
commit82a223e4e0bf45827c20592aaa7d5690593802ff (patch)
tree9b4072aa72aa5233cb146ee0e916d974668db12f /TOOLS/lua
parentbe337aa41567b6603ad5b017ff8add6a5f1e0bd8 (diff)
downloadmpv-82a223e4e0bf45827c20592aaa7d5690593802ff.tar.bz2
mpv-82a223e4e0bf45827c20592aaa7d5690593802ff.tar.xz
TOOLS: add test script for property change notifications
Diffstat (limited to 'TOOLS/lua')
-rw-r--r--TOOLS/lua/observe-all.lua16
1 files changed, 16 insertions, 0 deletions
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